about summary refs log tree commit homepage
path: root/lib/rainbows/fiber/io.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-12-27 03:56:30 +0000
committerEric Wong <normalperson@yhbt.net>2010-12-27 04:05:18 +0000
commit40c22b3f0a2ace6e4b51a39624ac5ed5ee3d0162 (patch)
treeb4a5d4b5aa8bbec9851bbe77a5e524d614e30856 /lib/rainbows/fiber/io.rb
parentabb3f7e057bd5fb0aa97cae1410ce2f55ba12b9c (diff)
downloadrainbows-40c22b3f0a2ace6e4b51a39624ac5ed5ee3d0162.tar.gz
We can use the same interface as Rainbows::Fiber.sleep to avoid
blindly waking up readers at ever scheduler invocation.
Diffstat (limited to 'lib/rainbows/fiber/io.rb')
-rw-r--r--lib/rainbows/fiber/io.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb
index e96f4de..94996ee 100644
--- a/lib/rainbows/fiber/io.rb
+++ b/lib/rainbows/fiber/io.rb
@@ -82,7 +82,7 @@ class Rainbows::Fiber::IO
         case rv = @to_io.kgio_tryread(16384, buf)
         when :wait_readable
           return if expire && expire < Time.now
-          expire ||= Time.now + G.kato
+          expire ||= read_expire
           kgio_wait_readable
         else
           return rv
@@ -93,7 +93,7 @@ class Rainbows::Fiber::IO
         return @to_io.read_nonblock(16384, buf)
       rescue Errno::EAGAIN
         return if expire && expire < Time.now
-        expire ||= Time.now + G.kato
+        expire ||= read_expire
         kgio_wait_readable
       end while true
     end