From 42747db815ad668b20849afb2a9dcdd1319713ae Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 2 Nov 2010 12:32:23 -0700 Subject: avoid Errno::EAGAIN, harder Errno::EAGAIN is still a problem under Ruby 1.9.2, so try harder to avoid it and use kgio methods. Even when 1.9.3 is available, kgio will still be faster as exceptions are slower than normal return values. --- lib/rainbows/writer_thread_pool.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/rainbows/writer_thread_pool.rb') diff --git a/lib/rainbows/writer_thread_pool.rb b/lib/rainbows/writer_thread_pool.rb index a81725a..e8cad91 100644 --- a/lib/rainbows/writer_thread_pool.rb +++ b/lib/rainbows/writer_thread_pool.rb @@ -42,6 +42,10 @@ module Rainbows to_io.kgio_trywrite(buf) end + def timed_read(buf) + to_io.timed_read(buf) + end + def write(buf) q << [ to_io, buf ] end -- cgit v1.2.3-24-ge0c7