class Celluloid::Internals::Signals
Event signaling between methods of the same object
Public Class Methods
new()
click to toggle source
# File lib/celluloid/internals/signals.rb, line 5 def initialize @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/internals/signals.rb, line 18 def broadcast(name, value = nil) condition = @conditions.delete(name) condition.broadcast(value) if condition end
wait(name)
click to toggle source
Wait for the given signal and return the associated value
# File lib/celluloid/internals/signals.rb, line 10 def wait(name) fail "cannot wait for signals while exclusive" if Celluloid.exclusive? @conditions[name] ||= Condition.new @conditions[name].wait end