public Method

Mutex.exclusive_unlock() { || ... }

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

Source Code

# File thread.rb, line 140
def exclusive_unlock
  return unless @locked
  Thread.exclusive do
    @locked = false
    begin
      t = @waiting.shift
      t.wakeup if t
    rescue ThreadError
      retry
    end
    yield
  end
  self
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.