Function | Package: mp | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## 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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version