class Async::DebugSelector
def close
def close if @monitors.any? $stderr.puts "Trying to close selector with active monitors: #{@monitors.values.inspect}!" end @selector.close end
def deregister(io)
def deregister(io) $stderr.puts "Deregistering #{io.inspect}." unless @monitors.delete(io.fileno) raise RuntimeError, "Trying to remove monitor for #{io.inspect} but it was not registered!" end end
def initialize(selector)
def initialize(selector) @selector = selector @monitors = {} end
def register(io, interests)
def register(io, interests) $stderr.puts "Registering #{io.inspect} for #{interests}." if monitor = @monitors[io.fileno] raise RuntimeError, "Trying to register monitor for #{io.inspect} but it was already registered as #{monitor.io.inspect}!" end @monitors[io.fileno] = io MonitorProxy.new(@selector.register(io, interests), self) end
def select(*args)
def select(*args) @selector.select(*args) end
def wakeup
def wakeup @selector.wakeup end