Event signaling between methods of the same object
Public Class Methods
new()click to toggle source
# File lib/celluloid/signals.rb, line 4definitialize@conditions = {}
end
Public Instance Methods
broadcast(name, value = nil)click to toggle source
Send a signal to all method calls waiting for the given name
# File lib/celluloid/signals.rb, line 17defbroadcast(name, value = nil)
ifcondition = @conditions.delete(name)
condition.broadcast(value)
endend
wait(name)click to toggle source
Wait for the given signal and return the associated value
# File lib/celluloid/signals.rb, line 9defwait(name)
raise"cannot wait for signals while exclusive"ifCelluloid.exclusive?@conditions[name] ||=Condition.new@conditions[name].waitend