Summary: This should be the last test abusing sleeps.
Test Plan: ran
Reviewed By: hannesr@fb.com
Subscribers: fugalh, njormrod
FB internal diff:
D1580830
Tasks:
5225808
EXPECT_THROW(t.value(), std::runtime_error);
});
// Test doing actual async work
- fe.addFuture([] () {
+ folly::Baton<> baton;
+ fe.addFuture([&] () {
auto p = std::make_shared<Promise<int>>();
std::thread t([p](){
burnMs(10)();
}).then([&] (Try<int>&& t) {
EXPECT_EQ(42, t.value());
c++;
+ baton.post();
});
- burnMs(15)(); // Sleep long enough for the promise to be fulfilled
+ baton.wait();
fe.join();
EXPECT_EQ(6, c);
}