Holds a lock while executing a body of code. If a failure clause is supplied, then it will be evaluated and its values returned from with-lock if the lock cannot be claimed (because a timeout occurred). The default, if no failure clause is supplied, is to signal an exception of class <timeout-exceeded>. If there is no failure, with-lock returns the results of evaluating the body.
with-lock ( (lock), (keys) )
(body)
failure (failure)
end
| lock | An instance of <lock>. The lock to claim. |
| keys | Optional keyword parameters to with-lock. |
| body | A series of semicolon-separated expressions. |
| failure | An optional value to return if the lock cannot be claimed. |