Browse Source

counting semaphore: comment improvements

master
Luca Saiu 2 weeks ago
parent
commit
67bbd51b23
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/CountingSemaphore.hh

+ 4
- 1
src/CountingSemaphore.hh View File

@ -44,7 +44,10 @@ namespace pEp {
{
std::unique_lock<std::mutex> lock(mtx);
// FIXME: is the loop even needed? Any received notification will
// wake up ony one thread, which will see the count as non-zero...
// wake up only one thread, which will see the count as non-zero...
// I guess an if conditional would work just as well as a while
// loop, but I will follow the canonical pattern just in case some
// new bizarre operation other than V is added later.
while (_count.load() == 0)
cv.wait(lock);
_count --;


Loading…
Cancel
Save