From: Robert Klemme Date: 2009-11-23T19:02:00+09:00 Subject: Re: issues with Kernel#select 2009/11/23 Eric Wong : > Tim Pease wrote: >> Thanks for the answer. My suspicion is that the Ruby 1.8 green threads >> can be woken up, but the Ruby 1.9 system threads "do the right thing"; >> hence, the discrepancy in observed behavior. Good to know that it's >> not a bug in 1.9. >> >> /me goes off to rework code > > Yeah, I expect thread.wakeup to only work on thread-aware things like > sleeping on a condition variable or Thread.sleep.  1.8 wraps select() > and uses that as the basis of its green thread implementation, so its > harder to get around spurious wakeups.  For reliably waking up IO#select > I'd just write a byte to a pipe (useful with signal handlers, too, see: > http://cr.yp.to/docs/selfpipe.html) Another approach would be to use #select with a timeout and regularly check some condition. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/