Method: Mutex#synchronize
- Defined in:
- thread_sync.c
permalink #synchronize { ... } ⇒ Object
Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Mutex
.
611 612 613 614 615 616 617 618 619 |
# File 'thread_sync.c', line 611
static VALUE
rb_mutex_synchronize_m(VALUE self)
{
if (!rb_block_given_p()) {
rb_raise(rb_eThreadError, "must be called with a block");
}
return rb_mutex_synchronize(self, rb_yield, Qundef);
}
|