Template Function exathread::yieldUntilComplete(const Future<T>&)

Function Documentation

template<typename T>
details::YieldOp exathread::yieldUntilComplete(const Future<T> &future)

Suspend execution of your task and allow other tasks to run until a future resolves.

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:

future – The future of which to yield until completion. It is not guaranteed that execution will resume exactly when the future becomes complete.

Throws:

std::logic_error – If the specified future has already been completed

Returns:

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