libcopp  1.2.0
Functions
copp::this_coroutine Namespace Reference

Functions

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

Function Documentation

template<typename Tc >
Tc* copp::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 NULL

Definition at line 295 of file coroutine_context.h.

References get_coroutine(), and yield().

coroutine_context * copp::this_coroutine::get_coroutine ( )

get current coroutine

See also
detail::coroutine_context
Returns
pointer of current coroutine, if not in coroutine, return NULL

Definition at line 400 of file coroutine_context.cpp.

References copp::detail::get_this_coroutine_context().

Referenced by get(), my_runner(), cotask::impl::task_impl::this_task(), and yield().

int copp::this_coroutine::yield ( void **  priv_data = UTIL_CONFIG_NULLPTR)

yield current coroutine

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

Definition at line 402 of file coroutine_context.cpp.

References copp::COPP_EC_NOT_RUNNING, get_coroutine(), and copp::coroutine_context::yield().

Referenced by copp::coroutine_context::create(), get(), test_context_private_data_foo_runner::operator()(), and test_context_base_foo_runner::operator()().