(08/02/2011 07:46 AM), Aaron Patterson wrote:
> This seems very handy for read loops.  Always rescuing the exception
> bothered me.  I think this would be very good functionality when writing
> pure ruby servers.

Well... the request is about nonblocking IO so I assume the "pure ruby
server" you are talking about is single threaded.  When you write such
read loop, you normally use IO.select as follows:

    read_fds = [ fd1, fd2, ... ]
    loop do
       r, w, e = IO.select(read_fds)
       r.each do |f|
         str = f.readpartial        # ..... (*)
       end
    end

At the point marked with (*),  the socket in question is returned from
a select call, which means,  the call to f.readpartial would not block
because there must be something in a socket's buffer.

So when you  do a read loop,  nothing bothers you, as long  as you use
readpartial.