Class: Mongo::ConditionVariable Private
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Forwardable
|
|
Inherits: | Object |
Defined in: | lib/mongo/condition_variable.rb |
Overview
This is an implementation of a condition variable.
Class Method Summary
- .new(lock = Mutex.new) ⇒ ConditionVariable constructor Internal use only
Instance Method Summary
- #broadcast Internal use only
- #signal Internal use only
-
#wait(timeout = nil)
Internal use only
Waits for the condition variable to be signaled up to timeout seconds.
- #raise_unless_locked! private Internal use only
Instance Method Details
#broadcast
[ GitHub ]# File 'lib/mongo/condition_variable.rb', line 38
def broadcast raise_unless_locked! @cv.broadcast end
#raise_unless_locked! (private)
[ GitHub ]# File 'lib/mongo/condition_variable.rb', line 52
def raise_unless_locked! unless @lock.owned? raise ArgumentError, "the lock must be owned when calling this method" end end
#signal
[ GitHub ]# File 'lib/mongo/condition_variable.rb', line 43
def signal raise_unless_locked! @cv.signal end
#wait(timeout = nil)
Waits for the condition variable to be signaled up to timeout seconds. If condition variable is not signaled, returns after timeout seconds.
# File 'lib/mongo/condition_variable.rb', line 32
def wait(timeout = nil) raise_unless_locked! return false if timeout && timeout < 0 @cv.wait(@lock, timeout) end