10 my_task_t::ptr_t
task = my_task_t::create([]() {
11 std::cout <<
"task " << cotask::this_task::get<my_task_t>()->get_id() <<
" started" << std::endl;
13 std::cout <<
"task " << cotask::this_task::get<my_task_t>()->get_id() <<
" resumed" << std::endl;
17 std::cout <<
"task " <<
task->
get_id() <<
" created" << std::endl;
21 std::cout <<
"task " <<
task->
get_id() <<
" yield" << std::endl;
23 std::cout <<
"task " <<
task->
get_id() <<
" stoped, ready to be destroyed." << std::endl;
UTIL_FORCEINLINE id_type get_id() const LIBCOPP_MACRO_NOEXCEPT
virtual int yield(void **priv_data)=0
int start(void *priv_data, EN_TASK_STATUS expected_status=EN_TS_CREATED) override
int resume(void *priv_data, EN_TASK_STATUS expected_status=EN_TS_WAITING) override
LIBCOPP_COTASK_API impl::task_impl * get_task() LIBCOPP_MACRO_NOEXCEPT
get current running task