FunctionPackage: mpToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
This page is new in 9.0.

condition-variable-wait

Arguments: condvar lock &key timeout

The lock is released and the thread waits for the condition to be signaled. When the condition is signaled, the lock is re-aquired before returning to the caller. The calling program should then release the lock so that other threads may modify the data.

The lock argument must be an instance of mp:process-lock or mp:sharable-lock, and the lock must be owned by the calling thread. A sharable-lock instance must be owned in exclusive mode. If the lock is not owned or cannot be unlocked, an error is signaled.

The lock may also be nil. In that case, no unlocking or re-aquiring is done. This can be sufficient in very simple cases where the data is modified with atomic operations.

The timeout argument may be nil or a positive number of seconds to wait for the condition signal. A zero or negative timeout value will always return nil since a condition is signaled only if some thread is actually waiting for the signal.

The lock is re-aquired whether a signal is received or a timeout occurs.

The condition represented by the condition-variable which is the value of the condvar argument. The condition should be checked again when condition-variable-wait returns and the lock is re-aquired since the situation may have changed between the signal and the return. A non-nil result from condition-variable-wait indicates only that the condition was signaled once in the past; it does not say anything about the state of the condition at the moment. Checking the condition while holding the lock is needed to get a definitive answer.

Returns t if the condition was signalled; nil if timeout occurred first.

See Condition Variables in smp.htm.

See multiprocessing.htm for general information on multiprocessing in Allegro CL.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page is new in the 9.0 release.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
This page is new in 9.0.