Method: Mongo::DistinguishingSemaphore#wait
- Defined in:
- lib/mongo/distinguishing_semaphore.rb
#wait(timeout = nil) ⇒ true | false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Waits for the semaphore to be signaled up to timeout seconds. If semaphore is not signaled, returns after timeout seconds.
35 36 37 38 39 40 41 42 |
# File 'lib/mongo/distinguishing_semaphore.rb', line 35 def wait(timeout = nil) @lock.synchronize do @cv.wait(@lock, timeout) (!@queue.empty?).tap do @queue.clear end end end |