Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Thread::Mutex#lock
() -> self
mutex.lock → self
thread_sync.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/thread_sync.rb, line 360
def lock
Primitive.rb_mut_lock
end
Attempts to grab the lock and waits if it isn’t available. Raises ThreadError if mutex was locked by the current thread.