diff options
author | Jack Lloyd <[email protected]> | 2017-10-12 11:43:28 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-10-12 11:43:28 -0400 |
commit | 39d9e995f49c92d6737d5e641ca306be174a271f (patch) | |
tree | add121cd9834b7dd56c4b059159491d15741bd75 /src/lib/utils/barrier.cpp | |
parent | f60b816469ebc3b46aa64dcba0dcdcdb92e87301 (diff) | |
parent | 2e24a69581709366084d40348232cca1a5758438 (diff) |
Merge GH #1245 Restructure Barrier/Semaphore to avoid signed overflow warnings
Diffstat (limited to 'src/lib/utils/barrier.cpp')
-rw-r--r-- | src/lib/utils/barrier.cpp | 5 |
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, ¤t_syncs] { return m_syncs != current_syncs; }); } |