Locks, applies a setup function, calls condition-variable-broadcast and unlocks.
mp
lock-and-condition-variable-broadcast lock condvar lock-timeout setup-function &rest args => signaledp
lock⇩ |
A lock. |
condvar⇩ | |
lock-timeout⇩ |
A non-negative real or nil . |
setup-function⇩ |
A function designator. |
args⇩ |
Arguments to setup-function. |
signaledp |
A generalized boolean. |
The function lock-and-condition-variable-broadcast
locks the lock lock, applies the function setup-function to args, calls condition-variable-broadcast with condvar and unlocks lock. lock-and-condition-variable-broadcast
makes it easier to avoid mistakes when using a condition-variable.
If lock-timeout is non-nil, then lock-and-condition-variable-broadcast
returns nil
if lock cannot be locked within lock-timeout seconds.
lock-and-condition-variable-broadcast
performs the equivalent of:
(mp:with-lock (lock nil lock-timeout) (apply setup-function args) (mp:condition-variable-broadcast condvar))
It returns the result of the call to condition-variable-broadcast.
See condition-variable-broadcast and with-lock for more details.
setup-function is called with lock held, so it should do the minimum amount of work and avoid locking other locks.
lock-and-condition-variable-wait
simple-lock-and-condition-variable-wait
lock-and-condition-variable-signal
condition-variable-wait
condition-variable-signal
condition-variable-broadcast
processes-count
with-lock
19.7.1 Condition variables
19.4 Locks
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51