Class Task

Inheritance Relationships

Derived Types

Class Documentation

class Task

Base coroutine handle management class.

Warning

Do not interface with this class directly; it is documented but is not meant for general use

Subclassed by exathread::ValueTask< T >, exathread::VoidTask

Public Functions

Task() = default

Create a blank task.

explicit Task(std::coroutine_handle<details::Promise> h)

Create a task managing a coroutine.

Task(const Task &other) noexcept

Copy construction.

Task &operator=(const Task &other) noexcept

Copy assignment.

inline Task(Task &&other) noexcept

Move construction.

Task &operator=(Task &&other) noexcept

Move assignment.

~Task() noexcept
inline bool done() const noexcept

Check if a task has completed execution.

Returns:

Completion state

inline void resume()

Resume execution of a task.

Throws:

std::logic_error – If the task is done

inline details::Promise &promise() noexcept

Access the underlying promise.

Returns:

The promise data

inline const details::Promise &promise() const noexcept

Access the underlying promise.

Returns:

The promise data

inline std::coroutine_handle<details::Promise> handle() noexcept

Access the handle to the managed coroutine.

Returns:

The coroutine handle