carb::this_thread::spinTryWait
Defined in carb/thread/Util.h
- 
template<class Func>
 bool carb::this_thread::spinTryWait(Func &&f) noexcept(noexcept(f()))
- Calls a predicate until it returns true or a number of attempts have elapsed. - This function is recommended only for situations where exactly one thread is waiting on another thread. For multiple threads waiting on a predicate, use spinTryWaitWithBackoff(). - This function will call - finterspersed with increasing invocations of CARB_HARDWARE_PAUSE. After a certain number of attempts, the function gives up and returns- false. If- freturns- true, spinTryWait() immediately returns- true.- Note - This function does not enter the kernel to wait. - Parameters
- f – The predicate to call repeatedly until it returns - true.
- Returns
- trueimmediately when- freturns- true. If a number of attempts to call- fall return- falsethen the function gives up and- falseis returned.