Ruby Mutex Functions

EditRocket provides the following information on Mutex functions in the Ruby source code builder.

exclusive_unlock() - If the mutex is locked, unlocks the mutex, wakes one waiting thread, and yields in a critical section.

lock() - Attempts to grab the lock and waits if it isn't available.

locked?() - Returns true if this lock is currently held by some thread.

new() - Creates a new Mutex

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

try_lock() - Attempts to obtain the lock and returns immediately. Returns true if the lock was granted.

unlock() - Releases the lock. Returns nil if ref wasn't locked.