Browse Source

counting semaphore: comment improvements

pull/10/head
Luca Saiu 4 years ago
parent
commit
67bbd51b23
  1. 5
      src/CountingSemaphore.hh

5
src/CountingSemaphore.hh

@ -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