spinWaitTimedUntil

inline fun spinWaitTimedUntil(timeoutNano: Long, condition: () -> Boolean): Long

Waits in a spin-loop until the specified condition is met or the timeout is reached.

Return

The elapsed time in nanoseconds if the condition is met before the timeout; -1 if the timeout is reached.

Parameters

timeoutNano

The maximum time to wait in nanoseconds.

condition

A lambda function that determines the condition to wait for. The function should return true when the condition is satisfied, and false otherwise.