diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-12-27 03:56:30 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-12-27 04:05:18 +0000 |
commit | 40c22b3f0a2ace6e4b51a39624ac5ed5ee3d0162 (patch) | |
tree | b4a5d4b5aa8bbec9851bbe77a5e524d614e30856 /lib/rainbows/fiber/io | |
parent | abb3f7e057bd5fb0aa97cae1410ce2f55ba12b9c (diff) | |
download | rainbows-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')
-rw-r--r-- | lib/rainbows/fiber/io/methods.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/rainbows/fiber/io/methods.rb b/lib/rainbows/fiber/io/methods.rb index 6c4d44d..29c9854 100644 --- a/lib/rainbows/fiber/io/methods.rb +++ b/lib/rainbows/fiber/io/methods.rb @@ -8,8 +8,13 @@ module Rainbows::Fiber::IO::Methods RD = Rainbows::Fiber::RD WR = Rainbows::Fiber::WR + ZZ = Rainbows::Fiber::ZZ attr_accessor :f + def read_expire + ZZ[Fiber.current] = super + end + # for wrapping output response bodies def each(&block) if buf = kgio_read(16384) @@ -30,6 +35,7 @@ module Rainbows::Fiber::IO::Methods @f = Fiber.current RD[fd] = self Fiber.yield + ZZ.delete @f RD[fd] = nil end |