wait(timeout = nil)
public
Releases the lock held in the associated monitor and waits; reacquires the
lock on wakeup.
If timeout is given, this method returns after timeout
seconds passed, even if no other thread doesn’t signal.
Show source
def wait(timeout = nil)
Thread.handle_interrupt(Exception => :never) do
@monitor.__send__(:mon_check_owner)
count = @monitor.__send__(:mon_exit_for_cond)
begin
Thread.handle_interrupt(Exception => :immediate) do
@cond.wait(@monitor.instance_variable_get(:@mon_mutex), timeout)
end
return true
ensure
@monitor.__send__(:mon_enter_for_cond, count)
end
end
end