libcopp  2.2.0
Functions
this_coroutine Namespace Reference

Functions

LIBCOPP_COPP_API coroutine_contextget_coroutine () LIBCOPP_MACRO_NOEXCEPT
 get current coroutine More...
 
template<typename Tc >
LIBCOPP_COPP_API_HEAD_ONLY Tc * get ()
 get current coroutine and try to convert type More...
 
LIBCOPP_COPP_API int yield (void **priv_data=nullptr) LIBCOPP_MACRO_NOEXCEPT
 yield current coroutine More...
 

Function Documentation

◆ get()

template<typename Tc >
LIBCOPP_COPP_API_HEAD_ONLY Tc* this_coroutine::get ( )

get current coroutine and try to convert type

See also
get_coroutine
detail::coroutine_context
Returns
pointer of current coroutine, if not in coroutine or fail to convert type, return nullptr

Definition at line 159 of file coroutine_context.h.

References get_coroutine().

Referenced by task< TCO_MACRO >::await_task().

◆ get_coroutine()

LIBCOPP_COPP_API coroutine_context * this_coroutine::get_coroutine ( )

◆ yield()

LIBCOPP_COPP_API int this_coroutine::yield ( void **  priv_data = nullptr)

yield current coroutine

Parameters
priv_dataprivate data, if not nullptr, will get the value from start(priv_data) or resume(priv_data)
Returns
0 or error code

Definition at line 477 of file coroutine_context.cpp.

References COPP_EC_NOT_RUNNING, COPP_LIKELY_IF, get_coroutine(), detail::get_this_coroutine_context(), and coroutine_context::yield().

Referenced by test_this_context_yield_runner::operator()().