On Sun, May 18, 2003 at 10:50:13PM +0900, Simon Strandgaard wrote:
> > Of course one solutions would be to fix those extensions (if it's possible -
> > I don't know if there is a non-blocking api to mysql). But I though, that
> > maybe ruby could replace the read() and write() functions of the libc with
> > something that respects other ruby threads (by using a rb_thread_select
> > loop) before loading c-extensions. 
> 
> I cannot distinguish if you are talking about mysql only problem ?  
> or a general problem with extensions ?
I notices this problem while working with the ruby dbi. The postgres driver
for the dbi uses the "block-all-others" function of the ruby-postgres
extensions written in C, altough the postgres driver has "correct" functions
too. Then I started checking other modules, and found the mysql and oracle
modules to have the same problem. 

> if this is mysql only, then why not propose it to the maintainer of 
> the mysql ruby extension ?
I will do that, but:

.) Maybe mysql has no non-blocking api. Then the maintainer can't fix this
either.

.) Since two out of four db modules I checked has this problem, I believe
this might affect other c-extensions that do read()s and write()s too...
Sometimes, one might just need a quick workaround for this, because getting
a maitainer to fix it can take some time.

Of course you are correct that the Right Thing(tm) is to fix the extensions.
But giving a user a chance to do a workaround, at least until the problem is
fixed, is not a bad thing IMHO.

That's why I thought that a require_fixup function would be a nice thing to
have....

greetings, Florian Pflug