spinWait#

Fully qualified name: carb::this_thread::spinWait

Defined in carb/thread/Util.h

template<class Func>
void carb::this_thread::spinWait(
Func &&f,
) noexcept(noexcept(f()))#

Calls a predicate repeatedly until it returns true.

This function is recommended only for situations where exactly one thread is waiting on another thread. For multiple threads waiting on a predicate, use spinWaitWithBackoff().

Note

This function does not return until f has returned true for the calling thread. For a version of this function that will give up, use spinTryWait().

Note

This function does not enter the kernel to wait.

Parameters:

f – The predicate to call repeatedly until it returns true.