spin Wait Timed Until
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
timeout Nano
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.