All Manuals > LispWorks® User Guide and Reference Manual > 42 The MP Package

condition-variable-wait Function

Summary

Waits for a given condition-variable to be signaled.

Package

mp

Signature

condition-variable-wait condvar lock &key timeout wait-reason => wakep

Arguments
condvar
lock
A lock.
timeout
A non-negative real or nil.
wait-reason
A string.
Values
wakep
A generalized boolean.
Description

The function condition-variable-wait waits at most timeout seconds for the condition-variable condvar to be signaled. The lock lock is released while waiting and claimed again before returning. The caller must be holding the lock lock before calling this function.

The return value wakep is non-nil if the signal was received or nil if there was a timeout. If timeout is nil, condition-variable-wait waits indefinitely.

If wait-reason is non-nil, it is used as the wait reason while waiting for the signal.

It is recommended that you use lock-and-condition-variable-wait or simple-lock-and-condition-variable-wait instead of condition-variable-wait. The locking functions make it easier to avoid mistakes, and can be more efficient.

Notes

timeout controls how long to wait for the signal: before returning, the function waits to claim lock, possibly indefinitely.

See also

condition-variable-wait-count
make-condition-variable
lock-and-condition-variable-wait
simple-lock-and-condition-variable-wait
lock-and-condition-variable-signal
lock-and-condition-variable-broadcast
condition-variable-signal
condition-variable-broadcast
19.7.1 Condition variables


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51