From 11aac0ecf6851429e9815f09bde7cd1ec11c0bf8 Mon Sep 17 00:00:00 2001 From: Hannes Roth Date: Wed, 19 Mar 2014 16:45:58 -0700 Subject: [PATCH] (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 --- folly/wangle/test/ThreadGateTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/folly/wangle/test/ThreadGateTest.cpp b/folly/wangle/test/ThreadGateTest.cpp index ef434ac6..41ae3cb2 100644 --- a/folly/wangle/test/ThreadGateTest.cpp +++ b/folly/wangle/test/ThreadGateTest.cpp @@ -145,7 +145,8 @@ TEST_F(GenericThreadGateFixture, gate_with_promise) { }); 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. tg.gate([&p, &eastPromiseMade, this] { EXPECT_EQ(t.get_id(), std::this_thread::get_id()); @@ -162,4 +163,5 @@ TEST_F(GenericThreadGateFixture, gate_with_promise) { EXPECT_TRUE(westThenCalled); EXPECT_TRUE(eastPromiseMade); EXPECT_EQ(f.value(), 1); + thread.join(); } -- 2.34.1