25 using namespace folly;
41 return [&]()
mutable {
42 auto p = std::make_shared<Promise<Unit>>();
43 p->setInterruptHandler(
49 return p->getFuture();
62 std::queue<std::shared_ptr<Promise<Unit>>> ps;
65 bool complete =
false;
68 auto thunk =
makeThunk(ps, interrupt, ps_mutex);
70 .thenValue([&](
auto&&)
mutable { complete =
true; })
88 std::queue<std::shared_ptr<Promise<Unit>>> ps;
91 bool complete =
false;
94 auto thunk =
makeThunk(ps, interrupt, ps_mutex);
96 .thenValue([&](
auto&&)
mutable { complete =
true; })
104 auto p2 = ps.front();
108 p2->setException(eggs);
116 std::queue<std::shared_ptr<Promise<Unit>>> ps;
119 bool complete =
false;
120 bool failure =
false;
122 auto thunk =
makeThunk(ps, interrupt, ps_mutex);
124 .thenValue([&](
auto&&)
mutable { complete =
true; })
132 for (
int i = 1;
i <= 3; ++
i) {
#define EXPECT_EQ(val1, val2)
std::function< bool(void)> makePred(int &i)
—— Concurrent Priority Queue Implementation ——
#define EXPECT_TRUE(condition)
static eggs_t eggs("eggs")
std::function< Future< Unit >void)> makeThunk(std::queue< std::shared_ptr< Promise< Unit >>> &ps, int &interrupt, std::mutex &ps_mutex)
#define EXPECT_FALSE(condition)
Future< Unit > times(const int n, F &&thunk)
TEST(SequencedExecutor, CPUThreadPoolExecutor)
void popAndFulfillPromise(std::queue< std::shared_ptr< Promise< Unit >>> &ps, std::mutex &ps_mutex)