Skip to contentSkip to conversation

Always Signal() the first Cond when changing the maximum

PATCH New Loic Dachary 1 participant 1 message Jan 21, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Always Signal() the first Cond when changing the maximum

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

---
 src/common/Throttle.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/common/Throttle.cc +1 -1
index 844263a..82ffe7a 100644
@@ -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);
Signature · 1 line
1.7.10.4