From: Eric Wong Date: 2018-04-21T18:02:20+00:00 Subject: [ruby-core:86644] Re: [Ruby trunk Bug#14681] `syswrite': stream closed in another thread (IOError) 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: