ConditionalBoolean

A ConditionalValue specialized for boolean values, providing waitUntilTrue and waitUntilFalse convenience methods.

Parameters

initValue

the initial boolean value.

Constructors

Link copied to clipboard
constructor(initValue: Boolean)

Functions

Link copied to clipboard
fun get(): Boolean

Returns the current value.

Link copied to clipboard
suspend fun set(value: Boolean)

Sets the value and yields to allow waiting coroutines to observe the change.

Link copied to clipboard
suspend fun waitUntil(timeoutDuration: Duration = Duration.INFINITE, predicate: (Boolean) -> Boolean): Boolean

Suspends until the predicate becomes true or timeout occurs.

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

Suspends until the value becomes false or the timeout expires.

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

Suspends until the value becomes true or the timeout expires.