From: Robert Klemme Date: 2011-01-06T18:41:26+09:00 Subject: Re: Threading in ruby On Thu, Jan 6, 2011 at 10:28 AM, Vishnu I. wrote: >> The solution without queue would involve a ConditionVariable.  This is >> more appropriate than using sleep: >> >> https://gist.github.com/764540#file_sc2.rb > > ah I see. So does each wait get the corresponding signal? so if I have > 10 signals queued up, the next 10 waits can operate instantly? signals are not queued. All threads waiting on the condition are signalled (and woken up) - if there is no thread waiting, none is woken up. But that is not needed because of the condition and looping. The client will continue to work until the condition is false. The CV only serves the purpose to wake up threads should they go out of work to do. Btw, I recommend Doug Lea's book - it's about Java but concepts described there like thread confinement have broader validity. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/