Commit 43d3a315 authored by David Goldblatt's avatar David Goldblatt Committed by Facebook Github Bot

Fix SimpleBarrier

Summary:
Do the barrier completion test in a loop. (std::condition_variable has pthreads-style spurious wakeups).

(Sorry for missing this in review).

Reviewed By: djwatson

Differential Revision: D4302035

fbshipit-source-id: 3322d6a0ffba8c47c46bafb1d88034e1a0a9c652
parent efc07505
...@@ -51,7 +51,7 @@ struct SimpleBarrier { ...@@ -51,7 +51,7 @@ struct SimpleBarrier {
if (++num_ == count_) { if (++num_ == count_) {
cv_.notify_all(); cv_.notify_all();
} else { } else {
cv_.wait(lockHeld); cv_.wait(lockHeld, [&]() { return num_ >= count_; });
} }
} }
......
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