Locks a lock for the current process.
mp
process-lock lock &optional whostate timeout => result
lock⇩ |
A lock. |
whostate⇩ |
A string or nil . |
timeout⇩ |
A non-negative real or nil . |
result⇩ |
A boolean. |
The function process-lock
attempts to lock lock and returns t
if successful, or nil
if timed out.
If lock is already locked and its owner is the same as the result of get-current-process, then the value of recursivep in lock (see make-lock) controls what happens. If recursivep is true, then lock remains locked and an internal count is incremented (this is called recursive locking). Otherwise, an error is signaled.
The Lisp process sleeps until the lock can be locked or the timeout period specified by timeout in seconds expires. If timeout is nil
(the default) then process-lock
waits indefinitely.
If whostate is non-nil, it is used as the wait reason while waiting for lock.
result is t
if lock was successfully locked, and nil
otherwise.
process-lock
is guaranteed to return if it locked process, but may throw before locking, as described in 19.4.3 Guarantees and limitations when locking and unlocking.
(process-lock *my-lock* "waiting to lock" 10)
make-lock
process-exclusive-lock
process-unlock
with-lock
19.4 Locks
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51