class Async::IO::Trap
A cross-reactor/process notification pipe.
def initialize(name)
def initialize(name) @name = name @notifications = [] end
def install!
def install! Signal.trap(@name, &self.method(:trigger)) return self end
def trap
def trap task = Task.current task.annotate("waiting for signal #{@name}") notification = Notification.new @notifications << notification while true notification.wait yield end ensure if notification notification.close @notifications.delete(notification) end end
def trigger(signal_number = nil)
-
(void)-
def trigger(signal_number = nil) @notifications.each(&:signal) end