From 2718883797152977fd95c43171e98956f655119c Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Tue, 6 Jan 2015 12:22:52 -0800 Subject: [PATCH] join Summary: Fixes T5922800 (I think) Test Plan: TBH I don't know why detaching a temporary thread variable might cause the program to abort but this seems to be the most likely cause so I'm making this change and we'll see in a day or two if it fixes it. The test still passes and doesn't hang Reviewed By: davejwatson@fb.com Subscribers: fugalh, exa, folly-diffs@ FB internal diff: D1764374 Tasks: 5922800 Signature: t1:1764374:1420485233:2e4c81776ef6b6bdae18fbf2e99f0deea37b7879 --- folly/wangle/futures/test/TimekeeperTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/folly/wangle/futures/test/TimekeeperTest.cpp b/folly/wangle/futures/test/TimekeeperTest.cpp index 6edbb91d..49f8b0c9 100644 --- a/folly/wangle/futures/test/TimekeeperTest.cpp +++ b/folly/wangle/futures/test/TimekeeperTest.cpp @@ -58,7 +58,7 @@ TEST(Timekeeper, futureGet) { TEST(Timekeeper, futureGetBeforeTimeout) { Promise p; - std::thread([&]{ p.setValue(42); }).detach(); + auto t = std::thread([&]{ p.setValue(42); }); // Technically this is a race and if the test server is REALLY overloaded // and it takes more than a second to do that thread it could be flaky. But // I want a low timeout (in human terms) so if this regresses and someone @@ -66,6 +66,7 @@ TEST(Timekeeper, futureGetBeforeTimeout) { // blocked, and get a useful error message instead. If it does get flaky, // empirically increase the timeout to the point where it's very improbable. EXPECT_EQ(42, p.getFuture().get(seconds(2))); + t.join(); } TEST(Timekeeper, futureGetTimeout) { -- 2.34.1