waitUntilTrue

Blocks the current thread until monitorSatisfied returns true. This method is not interruptible.


Blocks the current thread until monitorSatisfied returns true or the timeout expires. This method is not interruptible.

Return

true if the condition was satisfied, false if the wait timed out.

Parameters

waitTime

the maximum duration to wait. A zero or negative duration checks the condition once.


Repeatedly waits for the condition to become true, invoking block on each timeout.

Return

true if the condition was satisfied, false if the block returned false.

Parameters

timeout

the duration of each wait attempt; at least 1 ms.

block

the action invoked on each timeout; return false to stop waiting.

Throws

if timeout is shorter than 1 ms.


fun waitUntilTrue(timeout: Duration, maxWait: Duration, block: MonitorAction?): Boolean

Repeatedly waits for the condition to become true, invoking block on each timeout, up to an overall maximum wait duration.

Return

true if the condition was satisfied, false if maxWait elapsed or block returned false.

Parameters

timeout

the duration of each wait attempt; at least 1 ms.

maxWait

the overall maximum duration to wait; see GenericMonitor for its limits.

block

the action invoked on each timeout; return false to stop waiting. May be null.

Throws

if timeout is shorter than 1 ms.