Method: Mutex#unlock

Defined in:
thread_sync.c

#unlockself

Releases the lock. Raises ThreadError if mutex wasn’t locked by the current thread.

Returns:

  • (self)

473
474
475
476
477
478
479
480
481
482
483
484
# File 'thread_sync.c', line 473

VALUE
rb_mutex_unlock(VALUE self)
{
    const char *err;
    rb_mutex_t *mutex = mutex_ptr(self);
    rb_thread_t *th = GET_THREAD();

    err = rb_mutex_unlock_th(mutex, th, GET_EC()->fiber_ptr);
    if (err) rb_raise(rb_eThreadError, "%s", err);

    return self;
}