Executes a body of code while holding a lock.
mp
with-lock (lock &optional whostate timeout) &body body => result
lock⇩ |
The lock. |
whostate⇩ |
A string or nil . |
timeout⇩ |
A non-negative real or nil . |
body⇩ |
The forms to execute. |
result |
The result of executing body. |
The macro with-lock
executes body while holding lock, and unlocks lock when body exits. This is the recommended way of using a lock. The value of body is returned normally. body is not executed if lock could not be locked, in which case, with-lock
returns nil
. timeout and whostate are used as specified by process-lock.
make-lock
process-lock
process-unlock
with-exclusive-lock
with-sharing-lock
19.4 Locks
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51