24 using namespace folly;
34 std::thread
small([&]() {
35 smalllot.park(0,
false, [] {
return true; }, [&]() { sb.
post(); });
37 std::thread
large([&]() {
38 largelot.park(0,
true, [] {
return true; }, [&]() { lb.
post(); });
44 smalllot.unpark(0, [&](
bool data) {
51 largelot.unpark(0, [&](
bool data) {
66 std::atomic<uint64_t> w{0};
68 lot.
park(0,
false, [&]() {
return w == 1; }, []() {});
79 bool unparked =
false;
94 template <
typename Wait>
99 [&]() {
return !wfunc(); },
100 [&]() { std::mutex::unlock(); });
110 std::atomic<bool> go{
false};
112 std::thread
t([&]() {
113 std::lock_guard<WaitableMutex>
g(mu);
114 mu.
wait([&]() {
return go ==
true; });
119 std::lock_guard<WaitableMutex>
g(mu);
constexpr bool kIsSanitizeThread
#define EXPECT_EQ(val1, val2)
void unpark(const Key key, Unparker &&func)
Future< Unit > sleep(Duration dur, Timekeeper *tk)
ParkResult park(const Key key, D &&data, ToPark &&toPark, PreWait &&preWait)
—— Concurrent Priority Queue Implementation ——
FOLLY_ALWAYS_INLINE void wait(const WaitOptions &opt=wait_options()) noexcept
constexpr auto data(C &c) -> decltype(c.data())
TEST(SequencedExecutor, CPUThreadPoolExecutor)