samuel / oriontransfer.org wrote:
> Excuse my ignorance, but if you call write, why can't you just
> directly invoke `::write`?  Why do you need to do
> `rb_thread_io_blocking_region`?

rb_thread_io_blocking_region releases the GVL because write(2) may
block on slow filesystem, full pipe/sockets, etc.

We no longer set O_NONBLOCK on sockets/pipes by default since
1.9+; and but that didn't help with slow filesystems whose
buffers are full (or using weird stuff like O_SYNC/O_DIRECT).

rb_thread_io_blocking_region is slightly different than
rb_thread_call_without_gvl because Ruby has traditionally
signaled cross-thread IO#close with IOError instead of undefined
platform-specific behavior (sometimes EBADF, sometimes blocks
for a long time and succeeds, ...).  I'm not sure I actually
agree with this behavior, just stating what things are.

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>