Class: MontorLock
- Inherits:
-
Object
- Object
- MontorLock
- Defined in:
- lib/farcall/monitor_lock.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize ⇒ MontorLock
constructor
A new instance of MontorLock.
- #notify ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize ⇒ MontorLock
Returns a new instance of MontorLock.
6 7 8 9 |
# File 'lib/farcall/monitor_lock.rb', line 6 def initialize @condition = ConditionVariable.new @mutex = Mutex.new end |
Instance Method Details
#notify ⇒ Object
11 12 13 14 15 |
# File 'lib/farcall/monitor_lock.rb', line 11 def notify @mutex.synchronize { @condition.signal } end |
#wait ⇒ Object
17 18 19 20 21 22 |
# File 'lib/farcall/monitor_lock.rb', line 17 def wait @mutex.synchronize { @condition.wait(@mutex) yield if block_given? } end |