class Async::IO::Notification

A cross-reactor/process notification pipe.

def close

def close
	@input.close
	@output.close
end

def initialize

def initialize
	pipe = ::IO.pipe
	
	# We could call wait and signal from different reactors/threads/processes, so we don't create wrappers here, because they are not thread safe by design.
	@input = pipe.first
	@output = pipe.last
end

def signal

Returns:
  • (void) -
def signal
	wrapper = Async::IO::Generic.new(@output)
	wrapper.write(".")
ensure
	wrapper.reactor = nil
end

def wait

Returns:
  • (Object) -
def wait
	wrapper = Async::IO::Generic.new(@input)
	wrapper.read(1)
ensure
	# Remove the wrapper from the reactor.
	wrapper.reactor = nil
end