D++ (DPP)  10.0.30
C++ Discord API Bot Library
dpp::detail::task::final_awaiter< R > Struct Template Reference

The object automatically co_await-ed at the end of a task. More...

#include "task.h"

Public Member Functions

bool await_ready () const noexcept
 Always suspend at the end of the task. More...
 
void await_resume () const noexcept
 Function called when this object is co_awaited by the standard library at the end of final_suspend. More...
 
std_coroutine::coroutine_handle await_suspend (handle_t< R > handle) const noexcept
 The suspension logic of the coroutine when it finishes. More...
 

Detailed Description

template<typename R>
struct dpp::detail::task::final_awaiter< R >

The object automatically co_await-ed at the end of a task.

Awaitable returned from task::promise_t's final_suspend.

Ensures nested coroutine chains are resolved, and the promise_t cleans up if it needs to.

Template Parameters
RReturn type of the task

Resumes the parent and cleans up its handle if needed

Member Function Documentation

◆ await_ready()

template<typename R >
bool dpp::detail::task::final_awaiter< R >::await_ready ( ) const
inlinenoexcept

Always suspend at the end of the task.

This allows us to clean up and resume the parent

◆ await_resume()

template<typename R >
void dpp::detail::task::final_awaiter< R >::await_resume ( ) const
inlinenoexcept

Function called when this object is co_awaited by the standard library at the end of final_suspend.

Do nothing, return nothing

◆ await_suspend()

template<typename R >
std_coroutine::coroutine_handle dpp::detail::task::final_awaiter< R >::await_suspend ( handle_t< R >  handle) const
noexcept

The suspension logic of the coroutine when it finishes.

Always suspend the caller, meaning cleaning up the handle is on us

Parameters
handleThe handle of this coroutine
Returns
std::coroutine_handle<> Handle to resume, which is either the parent if present or std::noop_coroutine() otherwise

References dpp::detail::task::awaited, dpp::detail::task::dangling, dpp::detail::task::done, and dpp::detail::task::started.


The documentation for this struct was generated from the following file: