9 #if defined(LIBCOPP_MACRO_ENABLE_STD_COROUTINE) && LIBCOPP_MACRO_ENABLE_STD_COROUTINE
11 static copp::callable_future<int> coroutine_callable_with_int_result() {
16 static copp::callable_future<void> coroutine_callable_with_void_result() {
21 static copp::callable_future<void> coroutine_simulator_task() {
26 auto current_status = co_yield copp::callable_future<int>::yield_status();
28 std::cout <<
"Current coroutine callable status: " <<
static_cast<uint32_t
>(current_status) << std::endl;
30 co_await coroutine_callable_with_void_result();
32 int result = co_await coroutine_callable_with_int_result();
33 std::cout <<
"Coroutine int callable result: " << result << std::endl;
38 auto rpc_result = coroutine_simulator_task();
42 rpc_result.get_internal_handle().resume();
44 std::cout <<
"Current coroutine callable status: " <<
static_cast<uint32_t
>(rpc_result.get_status()) << std::endl;
49 puts(
"this sample require cotask enabled and compiler support c++20 coroutine");
#define LIBCOPP_MACRO_STD_COROUTINE_NAMESPACE