Method: Copland::QueryableMutex#unlock

Defined in:
lib/copland/thread.rb

#unlockObject

Unlocks the mutex and sets the locking thread to nil.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/copland/thread.rb', line 78

def unlock
  return unless @locked
  Thread.critical = true
  @locked = false
  begin
    t = @waiting.shift
    t.wakeup if t
  rescue ThreadError
    retry
  end
  @locking_thread = nil
  Thread.critical = false
  begin
    t.run if t
  rescue ThreadError
  end
  self
end