proxygen
CoreTest.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2015-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 #include <folly/futures/Future.h>
20 
21 using namespace folly;
22 
23 TEST(Core, size) {
24  static constexpr size_t lambdaBufSize = 8 * sizeof(void*);
25  struct Gold {
29  std::atomic<futures::detail::State> state_;
30  std::atomic<unsigned char> attached_;
31  std::atomic<bool> interruptHandlerSet_;
32  futures::detail::SpinLock interruptLock_;
33  int8_t priority_;
34  Executor* executor_;
35  std::shared_ptr<RequestContext> context_;
36  std::unique_ptr<exception_wrapper> interrupt_;
37  std::function<void(exception_wrapper const&)> interruptHandler_;
38  };
39  // If this number goes down, it's fine!
40  // If it goes up, please seek professional advice ;-)
41  EXPECT_GE(sizeof(Gold), sizeof(futures::detail::Core<Unit>));
42 }
SpinLock is and must stay a 1-byte object because of how Core is laid out.
Definition: Core.h:65
PskType type
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
#define EXPECT_GE(val1, val2)
Definition: gtest.h:1932
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
folly::Function< void()> callback_
TEST(SequencedExecutor, CPUThreadPoolExecutor)