Commit e51d8547 authored by Hannes Roth's avatar Hannes Roth Committed by Sara Golemon

(Wangle) Clean up some data races in tests

Summary: Not 100% about the `ThreadWheelTimekeeper` test. It makes TSAN happy
though.

Reviewed By: @yfeldblum

Differential Revision: D2187901
parent be983813
......@@ -76,8 +76,8 @@ ThreadWheelTimekeeper::ThreadWheelTimekeeper() :
ThreadWheelTimekeeper::~ThreadWheelTimekeeper() {
eventBase_.runInEventBaseThreadAndWait([this]{
wheelTimer_->cancelAll();
eventBase_.terminateLoopSoon();
});
eventBase_.terminateLoopSoon();
thread_.join();
}
......
......@@ -52,8 +52,9 @@ TEST_F(TimekeeperFixture, after) {
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) {
......
......@@ -72,7 +72,7 @@ struct ViaFixture : public testing::Test {
std::shared_ptr<ManualExecutor> eastExecutor;
std::shared_ptr<ManualWaiter> waiter;
InlineExecutor inlineExecutor;
bool done;
std::atomic<bool> done;
std::thread t;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment