diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-06-18 08:10:55 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-06-18 08:10:55 +0000 |
commit | b290a65eb735aa89bb071e27f8421cc864c78e8c (patch) | |
tree | 52219aa1a4e34d351c0e833819ad26ad1f8667dd /lib/rainbows/fiber/io.rb | |
parent | b5a24fdbf928b675e478987393212651ef5909d6 (diff) | |
download | rainbows-b290a65eb735aa89bb071e27f8421cc864c78e8c.tar.gz |
This gives a tiny performance improvement to the FiberSpawn and FiberPool concurrency models.
Diffstat (limited to 'lib/rainbows/fiber/io.rb')
-rw-r--r-- | lib/rainbows/fiber/io.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/rainbows/fiber/io.rb b/lib/rainbows/fiber/io.rb index 5153070..5f925ca 100644 --- a/lib/rainbows/fiber/io.rb +++ b/lib/rainbows/fiber/io.rb @@ -19,21 +19,23 @@ module Rainbows end def close - RD.delete(self) - WR.delete(self) + fileno = to_io.fileno + RD[fileno] = WR[fileno] = nil to_io.close unless to_io.closed? end def wait_readable - RD[self] = false + fileno = to_io.fileno + RD[fileno] = self ::Fiber.yield - RD.delete(self) + RD[fileno] = nil end def wait_writable - WR[self] = false + fileno = to_io.fileno + WR[fileno] = self ::Fiber.yield - WR.delete(self) + WR[fileno] = nil end def write(buf) |