diff mbox

Always Signal() the first Cond when changing the maximum

Message ID 50FD42E0.3040101@dachary.org (mailing list archive)
State New, archived
Headers show

Commit Message

Loic Dachary Jan. 21, 2013, 1:30 p.m. UTC
Removes a test by which the waiting queue is only
 Signal()ed if the new maximum is lower than the current
 maximum.  There is no evidence of a use case where such a
 restriction would be useful. In addition waking up a thread
 when the maximum increases gives it a chance to immediately
 continue the suspended process instead of waiting for the
 next put().  For additional context see the discussion at
 http://marc.info/?t=135868938300001&r=1&w=4

Signed-off-by: Loic Dachary <loic@dachary.org>
---
 src/common/Throttle.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/common/Throttle.cc b/src/common/Throttle.cc
index 844263a..82ffe7a 100644
--- a/src/common/Throttle.cc
+++ b/src/common/Throttle.cc
@@ -65,7 +65,7 @@  Throttle::~Throttle()
 void Throttle::_reset_max(int64_t m)
 {
   assert(lock.is_locked());
-  if (m < ((int64_t)max.read()) && !cond.empty())
+  if (!cond.empty())
     cond.front()->SignalOne();
   logger->set(l_throttle_max, m);
   max.set((size_t)m);