/* * Document-method: synchronize * call-seq: synchronize { ... } * * Obtains a lock, runs the block, and releases the lock when the block * completes. See the example under Mutex. * */ static VALUE rb_mutex_synchronize(VALUE self) { rb_mutex_lock(self); return rb_ensure(rb_yield, Qundef, rb_mutex_unlock, self); }