class EventCore::PipeSource
A source that triggers when data is ready to be read from an internal pipe. Send data to the pipe with the (blocking) write() method.
Attributes
rio[R]
wio[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
EventCore::Source::new
# File lib/event_core.rb, line 125 def initialize super() @rio, @wio = IO.pipe @rio.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC | Fcntl::O_NONBLOCK) #@wio.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC | Fcntl::O_NONBLOCK) @buffer_size = 4096 end
Public Instance Methods
close!()
click to toggle source
Calls superclass method
EventCore::Source#close!
# File lib/event_core.rb, line 153 def close! super @rio.close unless @rio.closed? @wio.close unless @wio.closed? end
closed?()
click to toggle source
# File lib/event_core.rb, line 149 def closed? @rio.closed? end
consume_event_data!()
click to toggle source
# File lib/event_core.rb, line 141 def consume_event_data! begin @rio.read_nonblock(@buffer_size) rescue EOFError nil end end
select_io()
click to toggle source
# File lib/event_core.rb, line 133 def select_io @rio end
select_type()
click to toggle source
# File lib/event_core.rb, line 137 def select_type :read end
write(buf)
click to toggle source
# File lib/event_core.rb, line 159 def write(buf) @wio.write(buf) end