Attempts to obtain the lock and returns
immediately. Returns true if the lock was granted.
# File lib/thread.rb, line 78
def try_lock
result = false
Thread.critical = true
unless @locked
@locked = true
result = true
end
Thread.critical = false
result
end