Class: Actuator::ConditionVariable
- Inherits:
-
Object
- Object
- Actuator::ConditionVariable
- Defined in:
- lib/actuator/mutex.rb
Instance Method Summary collapse
- #broadcast ⇒ Object
-
#initialize ⇒ ConditionVariable
constructor
A new instance of ConditionVariable.
- #signal ⇒ Object
- #wait(mutex, timeout = nil) ⇒ Object
Constructor Details
#initialize ⇒ ConditionVariable
Returns a new instance of ConditionVariable.
77 78 79 |
# File 'lib/actuator/mutex.rb', line 77 def initialize @waiters = [] end |
Instance Method Details
#broadcast ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/actuator/mutex.rb', line 103 def broadcast waiters = @waiters @waiters = [] waiters.each do |waiter| job = waiter[1] next unless job.alive? Actuator.next_tick do waiter[0]._wake_up(job) if job.alive? end end self end |