Commit 27188837 authored by Hans Fugal's avatar Hans Fugal Committed by Viswanath Sivakumar

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
parent 4925e0f4
...@@ -58,7 +58,7 @@ TEST(Timekeeper, futureGet) { ...@@ -58,7 +58,7 @@ TEST(Timekeeper, futureGet) {
TEST(Timekeeper, futureGetBeforeTimeout) { TEST(Timekeeper, futureGetBeforeTimeout) {
Promise<int> p; Promise<int> 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 // 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 // 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 // I want a low timeout (in human terms) so if this regresses and someone
...@@ -66,6 +66,7 @@ TEST(Timekeeper, futureGetBeforeTimeout) { ...@@ -66,6 +66,7 @@ TEST(Timekeeper, futureGetBeforeTimeout) {
// blocked, and get a useful error message instead. If it does get flaky, // 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. // empirically increase the timeout to the point where it's very improbable.
EXPECT_EQ(42, p.getFuture().get(seconds(2))); EXPECT_EQ(42, p.getFuture().get(seconds(2)));
t.join();
} }
TEST(Timekeeper, futureGetTimeout) { TEST(Timekeeper, futureGetTimeout) {
......
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