28 std::cout <<
"task " << cotask::this_task::get<my_task_t>()->get_id() <<
" started" << std::endl;
29 cotask::this_task::get_task()->yield();
30 std::cout <<
"task " << cotask::this_task::get<my_task_t>()->get_id() <<
" resumed" << std::endl;
34 std::cout <<
"task " << cotask::this_task::get<my_task_t>()->get_id() <<
" started" << std::endl;
35 cotask::this_task::get_task()->yield();
36 std::cout <<
"task " << cotask::this_task::get<my_task_t>()->get_id() <<
" resumed" << std::endl;
40 int res =
task_mgr->add_task(co_task, 5, 0);
42 std::cerr <<
"some error: " << res << std::endl;
46 res =
task_mgr->add_task(co_another_task);
48 std::cerr <<
"some error: " << res << std::endl;
52 res =
task_mgr->start(co_task->get_id());
54 std::cerr <<
"start task " << co_task->get_id() <<
" failed, error code: " << res << std::endl;
57 res =
task_mgr->start(co_another_task->get_id());
59 std::cerr <<
"start task " << co_another_task->get_id() <<
" failed, error code: " << res << std::endl;
62 res =
task_mgr->resume(co_task->get_id());
64 std::cerr <<
"resume task " << co_task->get_id() <<
" failed, error code: " << res << std::endl;
67 res =
task_mgr->kill(co_another_task->get_id());
69 std::cerr <<
"kill task " << co_another_task->get_id() <<
" failed, error code: " << res << std::endl;
71 std::cout <<
"kill task " << co_another_task->get_id() <<
" finished." << std::endl;