From: Luis Lavena Date: 2009-07-15T02:35:05+09:00 Subject: Re: C ext / threading / callback issue, ruby-1.9.1p129 On Jul 14, 10:48 am, Andrew Reynhout wrote: > Roger Pack wrote: > > Does the callback use ruby code from within the thread blocking region? > > Yes, e.g.: > > rb_thread_blocking_region((rb_blocking_function_t *)w->callback, tmp_x, > RUBY_UBF_IO, 0); > > w->callback is the address of the Ruby proc.  The address is correct > afaict, but note that this does crash MRI before the callback appears to > execute (dereferencing failure?).  When w->callback is the address of > the C function, the callback runs, but the Ruby threads apparently > suspend. > > Both callbacks in this sample code are very simple -- they just print > the int value of tmp_x, which is the number of seconds since the watcher > thread was started. > Ruby-FFI issues, more related to callbacks can be asked at Ruby-ffi mailing list: http://kenai.com/projects/ruby-ffi/lists If memory plays well, I saw something related to callbacks not long ago there: http://kenai.com/projects/ruby-ffi/lists/dev/archive Sometimes the API hasn't been updated across the implementations. -- Luis Lavena