Sha256: 03a62e67a50735806d8e74210cfa8a6e9fb5fecb521edc3bb91045ed446360cb
Contents?: true
Size: 651 Bytes
Versions: 5
Compression:
Stored size: 651 Bytes
Contents
module Celluloid module Internals # Event signaling between methods of the same object class Signals def initialize @conditions = {} end # Wait for the given signal and return the associated value def wait(name) raise "cannot wait for signals while exclusive" if Celluloid.exclusive? @conditions[name] ||= Condition.new @conditions[name].wait end # Send a signal to all method calls waiting for the given name def broadcast(name, value = nil) condition = @conditions.delete(name) condition.broadcast(value) if condition end end end end
Version data entries
5 entries across 5 versions & 2 rubygems