class MontorLock

Public Class Methods

new() click to toggle source
# File lib/farcall/monitor_lock.rb, line 6
def initialize
  @condition = ConditionVariable.new
  @mutex = Mutex.new
end

Public Instance Methods

notify() click to toggle source
# File lib/farcall/monitor_lock.rb, line 11
def notify
  @mutex.synchronize {
    @condition.signal
  }
end
wait() { || ... } click to toggle source
# File lib/farcall/monitor_lock.rb, line 17
def wait
  @mutex.synchronize {
    @condition.wait(@mutex)
    yield if block_given?
  }
end