Base implementation of task::promise_t, without the logic that would depend on the return type. More...
#include "task.h"
Classes | |
struct | proxy_awaiter |
Proxy awaitable that wraps any co_await inside the task and checks for cancellation on resumption. More... | |
Public Member Functions | |
template<typename T > | |
auto | await_transform (T &&expr) const noexcept(noexcept(co_await_resolve(std::forward< T >(expr)))) |
Function called whenever co_await is used inside of the task. More... | |
std_coroutine::suspend_never | initial_suspend () const noexcept |
Function called by the standard library when the coroutine is created. More... | |
void | unhandled_exception () |
Function called by the standard library when an exception is thrown and not caught in the coroutine. More... | |
Public Attributes | |
std::atomic< bool > | cancelled = false |
Whether the task is cancelled or not. More... | |
detail::std_coroutine::coroutine_handle | parent = nullptr |
Parent coroutine to return to for nested coroutines. More... | |
std::atomic< state_t > | state = state_t::started |
State of the task, used to keep track of lifetime and status. More... | |
Base implementation of task::promise_t, without the logic that would depend on the return type.
Meant to be inherited from
|
inlinenoexcept |
Function called whenever co_await is used inside of the task.
dpp::task_cancelled_exception | On resumption if the task was cancelled |
References dpp::detail::co_await_resolve().
|
inlinenoexcept |
Function called by the standard library when the coroutine is created.
|
inline |
Function called by the standard library when an exception is thrown and not caught in the coroutine.
Stores the exception pointer to rethrow on co_await. If the task object is destroyed and was not cancelled, throw instead
References cancelled, dpp::detail::task::dangling, and state.
std::atomic<bool> dpp::detail::task::promise_base::cancelled = false |
Whether the task is cancelled or not.
Referenced by dpp::detail::task::promise_base::proxy_awaiter< A >::await_resume(), and unhandled_exception().
detail::std_coroutine::coroutine_handle dpp::detail::task::promise_base::parent = nullptr |
Parent coroutine to return to for nested coroutines.
std::atomic<state_t> dpp::detail::task::promise_base::state = state_t::started |
State of the task, used to keep track of lifetime and status.
Referenced by unhandled_exception().