On Sun, Jul 16, 2006 at 09:17:35PM +0900, Florian Frank wrote:
> Tanaka Akira wrote:
> >It is possible to implement timeout without timeout() as:
> >
> >    def rbuf_fill
> >      begin
> >        @rbuf << @io.read_nonblock(4096)
> >      rescue Errno::EWOULDBLOCK
> >        if IO.select([@io], nil, nil, @read_timeout)
> >          @rbuf << @io.read_nonblock(4096)
> >        else
> >          raise Timeout::TimeoutError
> >        end
> >      end
> >    end
> >  
> This would be even faster I think, because timeout also represents a lot 
> of overhead. For 1.8. those methods would have to be backported then. 
> Hint, hint... ;)

RUBY_VERSION                         # => "1.8.5"
RUBY_RELEASE_DATE                    # => "2006-06-24"
IO.instance_methods.grep(/nonblock/) # => ["read_nonblock", "write_nonblock"]

(Yes, I must remove them from my 1.8 vs. 1.9 changelog summary)

-- 
Mauricio Fernandez  -   http://eigenclass.org   -  singular Ruby