"Tanaka Akira" <akr / m17n.org> wrote:

> I modified the document of readpartial.
> I hope it makes the behaviour clear.
[...]
> - *  It blocks even if the nonblocking-flag is set.
> + *  It blocks on the situation IO#sysread causes Errno::EAGAIN.

Ah - OK, thanks!

> IO#syswrite causes EAGAIN.
[...]
> It is also possible on sockets.
[...]
> The condition is
> 1. IO#syswrite
> 2. pipe/socket (kernel) buffer is full
> 3. Ruby has only one thread (No I/O multiplexing using select)

Wow.  Thanks for the details!  I'm going to have to eat my
words on a couple recent posts where I thought ruby behaved
identically regardless of whether just one thread or multiple
threads existed.

Out of curiosity, is there a technical reason why it's 
desirable for #sysread to raise EAGAIN in this one situation?

It seems strange to have to clutter the ruby code with EAGAIN
checks, if just saying Thread.new{loop{sleep(1000000)}} means
I'll never have to check for EAGAIN in ruby.

If that makes sense.  I'm just wondering if there's a technical
reason why we wouldn't want the C code to hide EAGAIN from 
ruby code in all cases, not just most cases.


Thanks,

Regards,

Bill