class PhusionPassenger::Utils::Lock
def initialize(mutex)
def initialize(mutex) @mutex = mutex @locked = false end
def lock
def lock raise if @locked @mutex.lock @locked = true end
def reset(mutex, lock_now = true)
def reset(mutex, lock_now = true) unlock if @locked @mutex = mutex lock if lock_now end
def synchronize
def synchronize lock if !@locked begin yield(self) ensure unlock if @locked end end
def unlock
def unlock raise if !@locked @mutex.unlock @locked = false end