123456789_123456789_123456789_123456789_123456789_

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

Instance Method Summary

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.

[ GitHub ]

  
# 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