yieldUntil

suspend fun yieldUntil(timeout: Duration = Duration.INFINITE, timesPerTurn: Int = DEFAULT_MULTIPLE_TIMES_YIELDS, delayPerTurn: Duration = 10.milliseconds, constraint: () -> Boolean)

Calls yield until a constraint is met. After yielding a number of times there is a delay to prevent maxing out the CPU.

Parameters

timeout

The duration after which to stop

timesPerTurn

The number of times to call yield before enacting a delay. DEFAULT_MULTIPLE_TIMES_YIELDS by default.

delayPerTurn

The delay enacted after yielding a number of times as defined by timesPerTurn.

constraint

The constraint to check for.