Attempts to grab the lock and waits if it isn’t available.
# File thread.rb, line 92 def lock while (Thread.critical = true; @locked) @waiting.push Thread.current Thread.stop end @locked = true Thread.critical = false self end
<code/>
<pre/>
<code/>and<pre/>for code samples.