wwa-coro 0.0.1
Yet Another C++20 Coroutine Library
wwa::coro::eager_task Class Reference

Eager coroutine. More...

#include <eager_task.h>

+ Collaboration diagram for wwa::coro::eager_task:

Classes

struct  promise_type
 The promise type for the eager_task coroutine. More...
 

Detailed Description

Eager coroutine.

This class represents an eager coroutine, which starts execution immediately upon creation and does not suspend upon completion. From the caller's perspective, it runs synchoronously; the control is returned to the caller only after the coroutine finishes.

Example:

// Sample awaitable
{
co_return 3;
}
wwa::coro::eager_task my_eager_task()
{
const auto result = co_await my_task(); // Can be any awaitable
std::cout << "Result: " << result << "\n";
}
std::cout << "Starting eager task..." << "\n";
my_eager_task();
std::cout << "Eager task finished." << "\n";
Examples
advance_with_begin.cpp, async_generator.cpp, and eager_task.cpp.

Definition at line 32 of file eager_task.h.


The documentation for this class was generated from the following file: