Summary: Not 100% about the `ThreadWheelTimekeeper` test. It makes TSAN happy
though.
Reviewed By: @yfeldblum
Differential Revision:
D2187901
ThreadWheelTimekeeper::~ThreadWheelTimekeeper() {
eventBase_.runInEventBaseThreadAndWait([this]{
wheelTimer_->cancelAll();
+ eventBase_.terminateLoopSoon();
});
- eventBase_.terminateLoopSoon();
thread_.join();
}
TEST(Timekeeper, futureGet) {
Promise<int> p;
- std::thread([&]{ p.setValue(42); }).detach();
+ auto t = std::thread([&]{ p.setValue(42); });
EXPECT_EQ(42, p.getFuture().get());
+ t.join();
}
TEST(Timekeeper, futureGetBeforeTimeout) {
std::shared_ptr<ManualExecutor> eastExecutor;
std::shared_ptr<ManualWaiter> waiter;
InlineExecutor inlineExecutor;
- bool done;
+ std::atomic<bool> done;
std::thread t;
};