"headius (Charles Nutter)" <headius / headius.com> wrote:
> However, the buffering issue is harder to fix. I believe buffering.rb
> needs to go away entirely, or at least needs to not buffer data on its
> own.

I think so, too.  I believe any sort of explicit buffering by Ruby on
socket/pipe wrappers is wrong and only leads to surprising behavior and
bugs.

Anyways, I'm not sure if read/readpartial/write for IO.select should
ever be recommended.  select() manpage in Linux recommends using
O_NONBLOCK for all I/O operations because of spurious wakeups, too.
So perhaps we should only be doing the _nonblock variants anyways.

(Also, consider the multi-threaded case where several threads are all
 doing select + (recvmsg|accept) on the same shared socket)