Yielding to Higher Priority Tasks#
-
constexpr aw_yield tmc::yield()#
Returns an awaitable that suspends this task and resubmits it back to its current executor, so that a higher priority task can run.
-
inline bool tmc::yield_requested()#
Returns true if a higher priority task is requesting to run on this thread.
-
constexpr aw_yield_if_requested tmc::yield_if_requested()#
Returns an awaitable that suspends this task only if a higher priority task is requesting to run on this thread.
co_await yield_if_requested();
is equivalent to
if (yield_requested()) { co_await yield();}
-
template<ptrdiff_t N>
inline aw_yield_counter<N> tmc::check_yield_counter()# Returns an awaitable that, every
N
calls toco_await
, checksyield_requested()
and yields if that returns true. The counterpart functioncheck_yield_counter_dynamic()
allows passingN
as a runtime parameter.
-
inline aw_yield_counter_dynamic tmc::check_yield_counter_dynamic(size_t N)#
Returns an awaitable that, every
N
calls toco_await
, checksyield_requested()
and yields if that returns true. The counterpart functioncheck_yield_counter()
allows settingN
as a template parameter.