instance method
Monitor#synchronize
[T] () { () -> T } -> T
synchronize { } → result of the block
ext/monitor/monitor.c
View on GitHub ↗
static VALUE
monitor_synchronize(VALUE monitor)
{
struct monitor_args args;
monitor_args_init(&args, monitor);
monitor_enter0(&args);
return rb_ensure(monitor_sync_body, (VALUE)&args, monitor_sync_ensure, (VALUE)&args);
}
Enters exclusive section and executes the block. Leaves the exclusive section automatically when the block exits. See example under MonitorMixin.