wait(p1, p2 = v2)
public
Releases the lock held in mutex 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
static VALUE
rb_condvar_wait(int argc, VALUE *argv, VALUE self)
{
VALUE waiters = GET_CONDVAR_WAITERS(self);
VALUE mutex, timeout;
struct sleep_call args;
rb_scan_args(argc, argv, "11", &mutex, &timeout);
args.mutex = mutex;
args.timeout = timeout;
rb_ary_push(waiters, rb_thread_current());
rb_ensure(do_sleep, (VALUE)&args, delete_current_thread, waiters);
return self;
}