Sha256: e13af14dbbb9edbd7e2464e6b3dc86eb70cc1a67fbace7717491cc235c6a47be
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
# -*- encoding: binary -*- # # :enddoc: # this is used to augment Kgio::Socket and Kgio::Pipe-enhanced classes # for use with Rainbows! Do no use this directly, see # Rainbows::Fiber::IO::Pipe and Rainbows::Fiber::IO::Socket instead. 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 if buf = kgio_read(16384) yield buf yield buf while kgio_read(16384, buf) end self end def close fd = fileno RD[fd] = WR[fd] = nil super end def kgio_wait_readable fd = fileno @f = Fiber.current RD[fd] = self Fiber.yield ZZ.delete @f RD[fd] = nil end def kgio_wait_writable fd = fileno @f = Fiber.current WR[fd] = self Fiber.yield WR[fd] = nil end def self.included(klass) if klass.method_defined?(:kgio_write) klass.__send__(:alias_method, :write, :kgio_write) end end end
Version data entries
4 entries across 4 versions & 1 rubygems