Selectable object that can be used to wake IO.select from another thread
# File lib/core/container.rb, line 334 def initialize @rd, @wr = IO.pipe @lock = Mutex.new @set = false end
# File lib/core/container.rb, line 358 def close @rd.close @wr.close end
# File lib/core/container.rb, line 350 def reset @lock.synchronize do return unless @set @rd.read_nonblock(1) rescue nil @set = false end end
# File lib/core/container.rb, line 340 def to_io() @rd; end
# File lib/core/container.rb, line 342 def wake @lock.synchronize do return if @set # Don't write if already has data @set = true @wr.write_nonblock('x') rescue nil end end