Template Class Task¶
Defined in File task.h
Nested Relationships¶
Nested Types¶
Class Documentation¶
-
template<typename Result = void>
class Task¶ Lightweight C++20 coroutine for simple async operations.
Unlike Job<T>, Task does not use the work-stealing scheduler. Tasks are executed directly when co_awaited, making them suitable for simple sequential async code.
Example:
Task<int> simple_async_work() { co_return 42; } Task<void> caller() { int value = co_await simple_async_work(); co_return; }
- Template Parameters:
Result – Return type (use void for tasks without return values)
-
struct Awaiter¶
-
struct FinalAwaiter¶
-
struct Promise¶
Public Functions
-
inline void unhandled_exception() noexcept¶
-
inline std::suspend_always initial_suspend() noexcept¶
-
inline FinalAwaiter final_suspend() noexcept¶
-
inline Task<void> get_return_object()
-
inline void unhandled_exception() noexcept
-
inline void return_void() noexcept¶
-
inline std::suspend_always initial_suspend() noexcept
-
inline Task<void>::FinalAwaiter final_suspend() noexcept
-
inline void unhandled_exception() noexcept¶