Event signaling between methods of the same object
# File lib/celluloid/signals.rb, line 4 def initialize @conditions = {} end
Send a signal to all method calls waiting for the given name
# File lib/celluloid/signals.rb, line 17 def broadcast(name, value = nil) if condition = @conditions.delete(name) condition.broadcast(value) end end
Wait for the given signal and return the associated value
# File lib/celluloid/signals.rb, line 9 def wait(name) raise "cannot wait for signals while exclusive" if Celluloid.exclusive? @conditions[name] ||= Condition.new @conditions[name].wait end