| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
dpp::detail::task::final_awaiter< R > Struct Template Reference

The object automatically co_await-ed at the end of a task. Ensures nested coroutine chains are resolved, and the promise_t cleans up if it needs to. More...

`#include <task.h>`

## Public Member Functions

bool | await_ready () const noexcept
| Always suspend at the end of the task. This allows us to clean up and resume the parent.
void | await_resume () const noexcept
| Function called when this object is co_awaited by the standard library at the end of final_suspend. Do nothing, return nothing.
std_coroutine::coroutine_handle | 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.

## Detailed Description

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

The object automatically co_await-ed at the end of a task. Ensures nested coroutine chains are resolved, and the promise_t cleans up if it needs to.

Awaitable returned from task::promise_t's final_suspend. Resumes the parent and cleans up its handle if needed.

Template Parameters

  R | Return type of the task

## Member Function Documentation

## ◆ await_ready()

template<typename R>

bool dpp::detail::task::final_awaiter< R >::await_ready | ( |  | ) | const

inline nodiscard noexcept

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

inline noexcept

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

nodiscard noexcept

The suspension logic of the coroutine when it finishes. Always suspend the caller, meaning cleaning up the handle is on us.

Parameters

  handle | The handle of this coroutine

Returns
  std::coroutine_handle<> Handle to resume, which is either the parent if present or std::noop_coroutine() otherwise

D++ Library version 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0