From: Paul Brannan Date: 2001-12-14T02:44:43+09:00 Subject: [ruby-talk:28440] Re: [RCR] IO.select should return array for timeout. On Fri, Dec 14, 2001 at 02:30:24AM +0900, Yukihiro Matsumoto wrote: > Hmm... (thinking) ... Maybe I was wrong. I thought explicit timeout > check was rare case so that empty arrays are sufficient. Well, if I really didn't want to take an action when the timeout occurred, then I wouldn't have specified a timeout value :) I think, though, that using select() directly in Ruby is not a good idea anyway, since it doesn't allow me to arbitrarily combine components and have them share the same select() loop. A better solution is to use a Reactor or something similar, like ACE has: http://www.cs.wustl.edu/~schmidt/PDF/reactor-rules.pdf Then I can pass the reactor around to objects that want to respond to IO objects, register my read, write, and error callbacks, register my timers, and enter the event loop. The solution that is generally used in Ruby is to just have multiple threads (and from what I can tell, that just boils down to a single select() call anwhow, which is sorta cool), but in my experience this solution does not play well with extensions sometimes (and raises all sorts of synchronization issues). Paul