class ConditionVariable
source · line 10public class ConditionVariable public constructor(
/**
* The mutex released during waiting and reacquired before return.
*/
public val mutex: Mutex
) : Disposable
- Supertype
Disposable
A native condition variable associated with one mutex. Wait while holding that mutex and recheck the application predicate after waking.
property isDisposed
source · line 21public val isDisposed: Boolean
get: public read-only
Whether native condition-variable state has been released.
getter get
source · line 21get(): Boolean
constructor constructor
source · line 10constructor(public val mutex: Mutex)
parameter mutex
source · line 14public val mutex: Mutex
property mutex
source · line 14public val mutex: Mutex
get: public read-only
The mutex released during waiting and reacquired before return.
function signal
source · line 87public fun signal(): Unit
Wakes one eligible waiter; callers must still protect the shared predicate with the associated mutex.
function await
source · line 52public fun await(): Unit
Atomically releases the held mutex while waiting, then reacquires it. The timed overload returns false on timeout; a wake does not prove the application predicate.
function broadcast
source · line 93public fun broadcast(): Unit
Wakes all eligible waiters so they can recheck their predicates.
function await
source · line 59public fun await(timeout: Duration): Boolean
Atomically releases the held mutex while waiting, then reacquires it. The timed overload returns false on timeout; a wake does not prove the application predicate.
parameter timeout
source · line 59timeout: Duration
function dispose
source · line 108public override fun dispose(): Unit
- Overrides
dispose
Destroys the condition variable; disposal with an active wait is rejected.