From: "Florian G. Pflug" Date: 2003-05-19T08:38:34+09:00 Subject: Re: C Extensions blocking all ruby threads On Mon, May 19, 2003 at 02:56:56AM +0900, Idan Sofer wrote: > > > > .) Maybe mysql has no non-blocking api. Then the maintainer can't fix this > > either. > Perhaps he can, TCPSocket class for example is non-blocking. Yes, but there is a non-blocking api to file reads and writs in unix. > I understand this has something to do with rb_thread_select(), However > I've searched in > the archives and found no much details about it's behaviour(intern.h > wasn't very helpful > resource as well) rb_thread_select offers the same functionality as unix select(), but lets other threads run instead of blocking until one of the fd's you select() on becomes readable or writeable. Using rb_thread_select in a ruby c-extesion has the same effect as using normal select() in an non-ruby posix-threaded app. > I might be willing to attempt patching the mysql extension myself, If > someone can pinpoint > to a source of information about rb_thread_select(). Well, look at some extesions that use it (the async_* calls in the postgres extension are a good example), and compare this to the documentation of the select() syscall. That should give you a clear picture of whats going on.