There was a JIRA [1] opened recently concerning blocking calls in the
Ruby bindings, and asking for a means to release the global interpreter
lock for such calls.

The first issue to deal with is to provide a solution that would work on
both Ruby 1.8 and Ruby 1.9/2.0. In the latter case we have the
rb_thread_blocking_region() [2] Ruby API that can be used to mark a
method as blocking in order to release the GIL for a period of time.
However, there is no equivalent method in Ruby 1.8.

But what there is available in Ruby 1.8+ is the ability to wait on a
file descriptor. But this ability is also already exposed in the Ruby
bindings themselves using passive mode [3] to avoid the call to
Messenger.receive blocking the interpreter.

It strikes me that the solution should leverage the passive mode
capabilities of the underlying C code. After all, that's it's raison
d'etre, to make it possible in bindings to write non-blocking code code.

Thoughts? Ideas?


Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.

Attachment: pgpQIMKV969Iu.pgp
Description: PGP signature

Reply via email to