with-lock

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.

Exported from

Macro call

with-lock ( (lock), (keys) )
(body)
failure (failure)
end

Arguments

lockAn instance of <lock>.  The lock to claim.
keysOptional keyword parameters to with-lock.
bodyA series of semicolon-separated expressions.
failureAn optional value to return if the lock cannot be claimed.
Holds a lock while executing a body of code.
This is signaled when with-lock did not succeed in claiming a lock within the timeout period.
The Runtime-Threads module.
The threads module.
The class of locks.