Base class of dpp::task. More...
#include "task.h"
Public Member Functions | |
task_base ()=default | |
Default constructor, creates a task not bound to a coroutine. More... | |
task_base (const task_base &)=delete | |
Copy constructor is disabled. More... | |
task_base (task_base &&other) noexcept | |
Move constructor, grabs another task's coroutine handle. More... | |
~task_base () | |
Destructor. More... | |
bool | await_ready () const |
Check whether or not a call to co_await will suspend the caller. More... | |
decltype(auto) | await_resume () & |
Function called by the standard library when resuming. More... | |
decltype(auto) | await_resume () && |
Function called by the standard library when resuming. More... | |
decltype(auto) | await_resume () const & |
Function called by the standard library when resuming. More... | |
bool | await_suspend (std_coroutine::coroutine_handle<> caller) noexcept |
Second function called by the standard library when the task is co_await-ed, if await_ready returned false. More... | |
dpp::task< R > && | cancel () &&noexcept |
Cancel the task, it will stop the next time it uses co_await. More... | |
dpp::task< R > & | cancel () &noexcept |
Cancel the task, it will stop the next time it uses co_await. More... | |
bool | done () const noexcept |
Function to check if the task has finished its execution entirely. More... | |
task_base & | operator= (const task_base &)=delete |
Copy assignment is disabled. More... | |
task_base & | operator= (task_base &&other) noexcept |
Move assignment, grabs another task's coroutine handle. More... | |
Protected Attributes | |
handle_t< R > | handle |
The coroutine handle of this task. More... | |
Friends | |
struct | promise_t< R > |
Promise type of this coroutine. More... | |
Base class of dpp::task.
|
default |
Default constructor, creates a task not bound to a coroutine.
|
delete |
Copy constructor is disabled.
|
inlinenoexcept |
Move constructor, grabs another task's coroutine handle.
other | Task to move the handle from |
|
inline |
Destructor.
Destroys the handle.
References dpp::detail::task::task_base< R >::cancel(), dpp::detail::task::dangling, dpp::detail::task::done, and dpp::detail::task::task_base< R >::handle.
|
inline |
Check whether or not a call to co_await will suspend the caller.
This function is called by the standard library as a first step when using co_await. If it returns true then the caller is not suspended.
logic_exception | if the task is empty. |
References dpp::detail::task::done, and dpp::detail::task::task_base< R >::handle.
|
inline |
Function called by the standard library when resuming.
|
inline |
Function called by the standard library when resuming.
|
inline |
Function called by the standard library when resuming.
|
inlinenoexcept |
Second function called by the standard library when the task is co_await-ed, if await_ready returned false.
Stores the calling coroutine in the promise to resume when this task suspends.
caller | The calling coroutine, now suspended |
References dpp::detail::task::awaited, dpp::detail::task::done, dpp::detail::task::task_base< R >::handle, and dpp::detail::task::started.
|
inlinenoexcept |
Cancel the task, it will stop the next time it uses co_await.
On co_await-ing this task, throws dpp::task_cancelled_exception.
References dpp::detail::task::task_base< R >::handle.
|
inlinenoexcept |
Cancel the task, it will stop the next time it uses co_await.
On co_await-ing this task, throws dpp::task_cancelled_exception.
References dpp::detail::task::task_base< R >::handle.
Referenced by dpp::detail::task::task_base< R >::~task_base().
|
inlinenoexcept |
Function to check if the task has finished its execution entirely.
References dpp::detail::task::done, and dpp::detail::task::task_base< R >::handle.
|
delete |
Copy assignment is disabled.
|
inlinenoexcept |
Move assignment, grabs another task's coroutine handle.
other | Task to move the handle from |
References dpp::detail::task::task_base< R >::handle.
|
friend |
Promise type of this coroutine.
For internal use only, do not use.
|
protected |
The coroutine handle of this task.
Referenced by dpp::detail::task::task_base< R >::await_ready(), dpp::detail::task::task_base< R >::await_suspend(), dpp::detail::task::task_base< R >::cancel(), dpp::detail::task::task_base< R >::done(), dpp::detail::task::task_base< R >::operator=(), and dpp::detail::task::task_base< R >::~task_base().