Shows how to use coroutine with task.
#include <xtd/xtd>
class example {
public:
static auto main() async_ {
println("[main], thread {}] -> start", thread::current_thread().managed_thread_id());
auto message = co_await task<string>::run([] {return "Hello, World!";});
auto length = co_await task<usize>::run([](const any_object& message) {return as<string>(message).size();}, message);
println("message : {}", message);
println("length : {}", length);
println("[main, thread {}] -> end", thread::current_thread().managed_thread_id());
}
};
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:278