After acquiring a lock or a recursive lock, execute forms and then release the lock.
Arguments and values
|lock||A lock, a recursive lock, or a condition variable|
|whostate|| A string (default |
|forms|| An implicit |
|results||The values returned by evaluating the last form|
The values returned by evaluating the last form.
A thread attempts to re-acquire a (non-recursive) lock that it holds.
If a thread executes a
Acquire the lock controlling access to a critical section of code:
(with-lock-held (lock :whostate "Waiting for Critical Lock") (critical-section))A silly example showing a recursive re-acquisition of a recursive lock:
(with-lock-held (recursive-lock :whostate "Waiting for Critical Lock") (with-lock-held (recursive-lock :whostate "Again Waiting for Critical Lock") (critical-section)))Acquire the lock associated with
(with-lock-held (condition-variable) (condition-variable-signal condition-variable))
The whostate value is ignored by SBCL.
The GBBopen Project