End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Thread::Mutex#locked?
mutex.locked? → true or false
thread_sync.c
View on GitHub ↗
VALUE
rb_mutex_locked_p(VALUE self)
{
rb_mutex_t *mutex = mutex_ptr(self);
return RBOOL(mutex->fiber);
}
Returns true if this lock is currently held by some thread.