Class: MonitorMixin::ConditionVariable

Inherits:
Object
  • Object
show all
Defined in:
lib/rbot/compat19.rb

Instance Method Summary collapse

Instance Method Details

#broadcastObject



58
59
60
61
# File 'lib/rbot/compat19.rb', line 58

def broadcast
  @monitor.__send__(:mon_check_owner)
  @cond.broadcast
end

#signalObject



53
54
55
56
# File 'lib/rbot/compat19.rb', line 53

def signal
  @monitor.__send__(:mon_check_owner)
  @cond.signal
end

#wait(timeout = nil) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rbot/compat19.rb', line 39

def wait(timeout = nil)
  #if timeout
  #  raise NotImplementedError, "timeout is not implemented yet"
  #end
  @monitor.__send__(:mon_check_owner)
  count = @monitor.__send__(:mon_exit_for_cond)
  begin
    @cond.wait(@monitor.instance_variable_get("@mon_mutex"), timeout)
    return true
  ensure
    @monitor.__send__(:mon_enter_for_cond, count)
  end
end