BooleanWaiter

A coroutine-based waiter that suspends until a boolean value satisfies a condition.

Provides waitUntilTrue and waitUntilFalse convenience methods with optional timeout support. Any number of coroutines may wait concurrently; each is resumed independently when its own condition is met.

Parameters

initValue

the initial boolean value.

Constructors

Link copied to clipboard
constructor(initValue: Boolean)

Functions

Link copied to clipboard

Updates the monitored value and resumes every waiting coroutine whose predicate is now satisfied.

Link copied to clipboard
fun setValue(value: Boolean)

Sets the boolean value and resumes any waiting coroutines whose condition is now satisfied.

Link copied to clipboard
suspend fun waitUntilFalse(timeoutDuration: Duration = Duration.INFINITE): Boolean

Suspends until the value is (or becomes) false, or the timeout expires.

Link copied to clipboard
suspend fun waitUntilTrue(timeoutDuration: Duration = Duration.INFINITE): Boolean

Suspends until the value is (or becomes) true, or the timeout expires.