Commit 11aac0ec authored by Hannes Roth's avatar Hannes Roth Committed by Dave Watson

(Wangle) Fix tests for clang

Summary: `std::async` doesn't play nicely with our clang. Replace it with `std::thread`.

Test Plan: `fbconfig --clang folly/wangle && fbmake runtests`

Reviewed By: marccelani@fb.com

FB internal diff: D1230197
parent cd838428
...@@ -145,7 +145,8 @@ TEST_F(GenericThreadGateFixture, gate_with_promise) { ...@@ -145,7 +145,8 @@ TEST_F(GenericThreadGateFixture, gate_with_promise) {
}); });
bool eastPromiseMade = false; bool eastPromiseMade = false;
std::async(std::launch::async, [&p, &eastPromiseMade, this]() { auto thread = std::thread([&p, &eastPromiseMade, this]() {
EXPECT_NE(t.get_id(), std::this_thread::get_id());
// South thread != west thread. p gets set in west thread. // South thread != west thread. p gets set in west thread.
tg.gate<int>([&p, &eastPromiseMade, this] { tg.gate<int>([&p, &eastPromiseMade, this] {
EXPECT_EQ(t.get_id(), std::this_thread::get_id()); EXPECT_EQ(t.get_id(), std::this_thread::get_id());
...@@ -162,4 +163,5 @@ TEST_F(GenericThreadGateFixture, gate_with_promise) { ...@@ -162,4 +163,5 @@ TEST_F(GenericThreadGateFixture, gate_with_promise) {
EXPECT_TRUE(westThenCalled); EXPECT_TRUE(westThenCalled);
EXPECT_TRUE(eastPromiseMade); EXPECT_TRUE(eastPromiseMade);
EXPECT_EQ(f.value(), 1); EXPECT_EQ(f.value(), 1);
thread.join();
} }
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