Maintenance Ruby 3.3 gets fixes, but no new features. 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.