aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/barrier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/utils/barrier.cpp')
-rw-r--r--src/lib/utils/barrier.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/utils/barrier.cpp b/src/lib/utils/barrier.cpp
index 3c721d905..ed3878d18 100644
--- a/src/lib/utils/barrier.cpp
+++ b/src/lib/utils/barrier.cpp
@@ -20,9 +20,10 @@ void Barrier::wait(size_t delta)
void Barrier::sync()
{
std::unique_lock<mutex_type> lock(m_mutex);
- --m_value;
- if(m_value > 0)
+
+ if(m_value > 1)
{
+ --m_value;
const size_t current_syncs = m_syncs;
m_cond.wait(lock, [this, &current_syncs] { return m_syncs != current_syncs; });
}