A condition variable allows you to wait for some condition to be satisfied, based on the values stored in shared data that is protected by a lock. The condition is typically something like data becoming available in a queue.
Alternatively, the function
Any threads that wait after the call to condition-variable-signal or condition-variable-broadcast will not be woken until the next call.
In most uses of condition variables, the call to condition-variable-signal or condition-variable-broadcast should be made while holding the lock that waiter used when calling condition-variable-wait for this condition variable. This ensures that the signal is not lost if another thread is just about to call condition-variable-wait.
The condition variable implementation in LispWorks aims to comply with the POSIX standard where possible.
condition-variable-wait, condition-variable-signal and condition-variable-broadcast have corresponding functions lock-and-condition-variable-wait, lock-and-condition-variable-signal and lock-and-condition-variable-broadcast. For condition-variable-wait there is also simple-lock-and-condition-variable-wait, which is simpler to use. The
functions perform the equivalent of locking and in the scope of the lock doing something and calling the corresponding
functions not only make it simpler to code, they also make it easier to avoid mistakes, and can optimize some cases (in particular, the quite common case when there is no need to lock on exit from condition-variable-wait). They are the recommended interface.
functions can be used together with
functions on the same locks and condition variables.
Note: In cases when only one process waits for the condition, using process-wait-local for waiting and process-poke for signalling is easier, and involves less overhead.
LispWorks User Guide and Reference Manual - 21 Dec 2011