Mutex

ruby/spec describes 7 methods in core/mutex, and Metorex implements 7 of them. The parameters are what Method#parameters answers under Metorex.

  • Mutex#lock: implemented, parameters [[:rest, :args]]. Attempts to grab the lock and waits if it isn't available. An example calling it.
  • Mutex#locked?: implemented, parameters [[:rest, :args]]. Returns true if this lock is currently held by some thread. An example calling it.
  • Mutex#owned?: implemented, parameters [[:rest, :args]]. Returns true if this lock is currently held by current thread. An example calling it.
  • Mutex#sleep: implemented, parameters [[:rest]]. Releases the lock and sleeps timeout seconds if it is given and non-nil or forever. An example calling it.
  • Mutex#synchronize: implemented, parameters [[:rest, :args]]. Obtains a lock, runs the block, and releases the lock when the block completes. An example calling it.
  • Mutex#try_lock: implemented, parameters [[:rest, :args]]. Attempts to obtain the lock and returns immediately. An example calling it.
  • Mutex#unlock: implemented, parameters [[:rest, :args]]. Releases the lock. An example calling it.

The method summaries are the first sentences of Ruby's own documentation for each method, read from MRI 4.0.6's ri data. Ruby's documentation is distributed under Ruby's license.