From 67bbd51b230661e1f310b3e066289e796720119b Mon Sep 17 00:00:00 2001 From: Luca Saiu Date: Thu, 25 Nov 2021 15:57:46 +0100 Subject: [PATCH] counting semaphore: comment improvements --- src/CountingSemaphore.hh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CountingSemaphore.hh b/src/CountingSemaphore.hh index b63b01f..ddd632c 100644 --- a/src/CountingSemaphore.hh +++ b/src/CountingSemaphore.hh @@ -44,7 +44,10 @@ namespace pEp { { std::unique_lock 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 --;