Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Mutex#synchronize

mutex.synchronize { ... } → result of the block

Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Mutex.