Base class of dpp::task.
More...
template<typename R>
class dpp::detail::task::task_base< R >
Base class of dpp::task.
- Warning
- This class should not be used directly by a user, use dpp::task instead.
- Note
- This class contains all the functions used internally by co_await. It is intentionally opaque and a private base of dpp::task so a user cannot call await_suspend() and await_resume() directly.
◆ task_base() [1/3]
Default constructor, creates a task not bound to a coroutine.
◆ task_base() [2/3]
Copy constructor is disabled.
◆ task_base() [3/3]
Move constructor, grabs another task's coroutine handle.
- Parameters
-
other | Task to move the handle from |
◆ ~task_base()
Destructor.
Destroys the handle.
- Warning
- The coroutine must be finished before this is called, otherwise it runs the risk of being resumed after it is destroyed, resuming in use-after-free undefined behavior.
◆ await_ready()
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.
- Exceptions
-
- Returns
- bool Whether not to suspend the caller or not
◆ await_resume() [1/3]
Function called by the standard library when resuming.
- Returns
- Return value of the coroutine, handed to the caller of co_await.
◆ await_resume() [2/3]
Function called by the standard library when resuming.
- Returns
- Return value of the coroutine, handed to the caller of co_await.
◆ await_resume() [3/3]
Function called by the standard library when resuming.
- Returns
- Return value of the coroutine, handed to the caller of co_await.
◆ await_suspend()
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.
- Parameters
-
caller | The calling coroutine, now suspended |
- Returns
- bool Whether to suspend the caller or not
◆ cancel() [1/2]
◆ cancel() [2/2]
◆ done()
Function to check if the task has finished its execution entirely.
- Returns
- bool Whether the task is finished.
◆ operator=() [1/2]
Copy assignment is disabled.
◆ operator=() [2/2]
Move assignment, grabs another task's coroutine handle.
- Parameters
-
other | Task to move the handle from |
◆ promise_t< R >
Promise type of this coroutine. For internal use only, do not use.
◆ handle
The coroutine handle of this task.