Function exathread::yieldUntilTrue

Function Documentation

details::YieldOp exathread::yieldUntilTrue(std::function<bool()> predicate)

Suspend execution of your task and allow other tasks to run until a certain condition is met.

Note

As the use of this function makes your function a coroutine, it must explicitly return either a VoidTask or ValueTask and use co_return to be valid

Parameters:

predicate – A function that will evaluate the condition to determine if execution should resume. It should not have side effects.

Returns:

An awaitable object; you must use co_await on this result to yield correctly