From: Paul Brannan Date: 2007-02-23T05:15:04+09:00 Subject: Re: Stateful I/O interface On Tue, Feb 20, 2007 at 11:24:52AM +0900, Tony Arcieri wrote: > > Has anyone ever suggested adding a stateful I/O multiplexing > interface which could be used for things like network servers where > something like Kernel#select is less than ideal? For now, I think this is best done as a library. The reactor pattern is a well-accepted pattern for implementing such a mechanism. There is a reactor library for ruby, but it needs to have additional I/O multiplexing mechanisms implemented. I would like to see a way to pick a different I/O multiplexing mechanism at runtime. IMO the problem isn't what Kernel#select does (you don't have to use it), but what rb_thread_select does (you aren't given a choice here). Integrating ruby's event loop with a library that uses a different mechanism requires that the library be able to use ruby's I/O multiplexing system, but may not be possible or desirable, especially if ruby is embedded in an application. It's been suggested that Ruby use WaitForMultipleObjects on win32 (see [ruby-talk:47186]). There are pros and cons to doing this, but I'm not qualified to enumerate them. Paul