naruse / ruby-lang.org wrote:
>   https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63587

For OpenSSL, I think you need to expect : wait_readable on
write_nonblock, too.


Anyways, the code for handling partial write_nonblock case is verbose.
One day, I would like to:

1) integrate Timeout into core
2) make all SOCK_STREAM sockets non-blocking by default
3) Make rb_wait_for_single_fd aware of Timeouts

So we can use:

    Timeout.timeout(@write_timeout) { @io.write(strs) }

And no new background threads get spawned.


P.S.: If Ruby were LGPL-2.1+, I would steal the ccan/timer module which
      is optimized for frequently-expiring timers and be done with 1),
      already.

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