(Wangle) Fix tests for clang
authorHannes Roth <hannesr@fb.com>
Wed, 19 Mar 2014 23:45:58 +0000 (16:45 -0700)
committerDave Watson <davejwatson@fb.com>
Mon, 31 Mar 2014 17:44:09 +0000 (10:44 -0700)
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

index ef434ac6fc6d1615062a9494995303155aa31fac..41ae3cb218af4b32bd58482bb4c1ca99ef1c9864 100644 (file)
@@ -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<int>([&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();
 }