From 43d3a315bbd54cb187021897b566ffb53290a44b Mon Sep 17 00:00:00 2001 From: David Goldblatt Date: Thu, 8 Dec 2016 17:20:46 -0800 Subject: [PATCH 1/1] 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 --- folly/test/SmallLocksBenchmark.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/test/SmallLocksBenchmark.cpp b/folly/test/SmallLocksBenchmark.cpp index 9b86adf3..ca69b1a0 100644 --- a/folly/test/SmallLocksBenchmark.cpp +++ b/folly/test/SmallLocksBenchmark.cpp @@ -51,7 +51,7 @@ struct SimpleBarrier { if (++num_ == count_) { cv_.notify_all(); } else { - cv_.wait(lockHeld); + cv_.wait(lockHeld, [&]() { return num_ >= count_; }); } } -- 2.34.1