Object
Condition is a better implementation of standard Ruby ConditionVariable. The biggest difference is the wait return value: Condition#wait returns Condition::Result which make possible to know if waiting thread has been woken up by an another thread (using signal or broadcast) or due to timeout.
Every wait must be guarded by a locked Mutex or a ThreadError will be risen. Although it's not mandatory, it's recommended to call also signal and broadcast within the same mutex
@deprecated
Wakes up all waiting threads @return [true]
# File lib/concurrent/atomic/condition.rb, line 73 def broadcast @condition.broadcast true end
Wakes up a waiting thread @return [true]
# File lib/concurrent/atomic/condition.rb, line 66 def signal @condition.signal true end
@param [Mutex] mutex the locked mutex guarding the wait @param [Object] timeout nil means no timeout @return [Result]
@!macro monotonic_clock_warning
# File lib/concurrent/atomic/condition.rb, line 53 def wait(mutex, timeout = nil) start_time = Concurrent.monotonic_time @condition.wait(mutex, timeout) if timeout.nil? Result.new(nil) else Result.new(start_time + timeout - Concurrent.monotonic_time) end end
Generated with the Darkfish Rdoc Generator 2.