try_lock()
public
Attempts to obtain the lock and returns
immediately. Returns true if the lock was granted.
Show source
def try_lock
result = false
Thread.critical = true
unless @locked
@locked = true
result = true
end
Thread.critical = false
result
end