dpp::basic_promise
dpp::detail::promise::promise_base< T >
awaitable.h
typename T
bool Notify Notify true
typename... Args Args
void void dpp::basic_promise< T >::emplace_value (Args &&... args) emplace_value dpp::basic_promise::emplace_value Args &&... args (std::constructible_from<T, Args...>)

Construct the result in place by forwarding the arguments, and by default resume any awaiter.

Notify

Whether to resume any awaiter or not.

dpp::logic_exception

if the promise is not empty.

awaitable< T > awaitable< T > dpp::detail::promise::promise_base< T >::get_awaitable () get_awaitable dpp::detail::promise::promise_base::get_awaitable

Get an awaitable object for this promise.

dpp::logic_exception

if get_awaitable has already been called on this object.

awaitable<T> An object that can be co_await-ed to retrieve the value of this promise.

void void dpp::detail::promise::promise_base< T >::notify_awaiter () notify_awaiter dpp::detail::promise::promise_base::notify_awaiter

Notify a currently awaiting coroutine that the result is ready.

This may resume the coroutine on the current thread.

?

Any exception thrown by the coroutine if resumed will propagate

bool Notify Notify true
void void dpp::detail::promise::promise_base< T >::set_exception (std::exception_ptr ptr) set_exception dpp::detail::promise::promise_base::set_exception std::exception_ptr ptr

Set this promise to an exception and resume any awaiter.

Notify

Whether to resume any awaiter or not.

dpp::logic_exception

if the promise is not empty.

?

Any exception thrown by the coroutine if resumed will propagate

bool Notify Notify true
void void dpp::basic_promise< T >::set_value () set_value dpp::basic_promise::set_value (std::is_void_v<T>)

Construct a void result, and resume any awaiter.

Notify

Whether to resume any awaiter or not.

dpp::logic_exception

if the promise is not empty.

bool Notify Notify true
typename U T
void void dpp::basic_promise< T >::set_value (U &&v) set_value dpp::basic_promise::set_value U && v (std::convertible_to<U&&, T>)

Construct the result by forwarding reference, and resume any awaiter.

Notify

Whether to resume any awaiter or not.

dpp::logic_exception

if the promise is not empty.

result_t< T > using dpp::detail::promise::promise_base< T >::storage_type = result_t<T> storage_type dpp::detail::promise::promise_base::storage_type

Variant representing one of either 3 states of the result value : empty, result, exception.

std_coroutine::coroutine_handle std_coroutine::coroutine_handle dpp::detail::promise::promise_base< T >::awaiter awaiter dpp::detail::promise::promise_base::awaiter = nullptr

Coroutine handle currently awaiting the completion of this promise.

std::atomic< uint8_t > std::atomic<uint8_t> dpp::detail::promise::promise_base< T >::state state dpp::detail::promise::promise_base::state = sf_none

State of the awaitable tied to this promise.

storage_type storage_type dpp::detail::promise::promise_base< T >::value value dpp::detail::promise::promise_base::value = std::monostate{}

State of the result value.

storage_type

use .index() instead of std::holds_alternative to support promise_base<std::exception_ptr> and promise_base<std::monostate> :)

std_coroutine::coroutine_handle std_coroutine::coroutine_handle dpp::detail::promise::promise_base< T >::release_awaiter () release_awaiter dpp::detail::promise::promise_base::release_awaiter

Unlinks this promise from its currently linked awaiter and returns it.

At the time of writing this is only used in the case of a serious internal error in dpp::task. Avoid using this as this will crash if the promise is used after this.

void void dpp::detail::promise::promise_base< T >::throw_if_not_empty () throw_if_not_empty dpp::detail::promise::promise_base::throw_if_not_empty

Check if the result is empty, throws otherwise.

dpp::logic_exception

if the result isn't empty.

Generic promise class, represents the owning potion of an asynchronous value.

This class is roughly equivalent to std::promise, with the crucial distinction that the promise IS the shared state. As such, the promise needs to be kept alive for the entire time a value can be retrieved.

T

Type of the asynchronous value

awaitable

dpp::basic_promise< R >
< R >
dpp::basic_promise< T >
dpp::basic_promise< void >
< void >
dpp::detail::promise::promise_base< T >
dpp::detail::task::promise_base< R >
dpp::detail::task::promise_base< void >
< void >
dpp::detail::task::promise_t< R >
dpp::detail::task::promise_t< T >
< T >
dpp::detail::task::promise_t< void >
< void >
T
dpp::basic_promise< T >
dpp::detail::promise::promise_base< T >
value
state
awaiter
result_t< T >
std::atomic< T >
ptr
std::atomic< uint8_t >
ptr
< uint8_t >
coroutine_handle
uint8_t
- dpp::basic_promise
  awaiter
- dpp::basic_promise
  emplace_value
- dpp::basic_promise
  get_awaitable
- dpp::basic_promise
  notify_awaiter
- dpp::basic_promise
  operator=
- dpp::basic_promise
  operator=
- dpp::basic_promise
  promise_base
- dpp::basic_promise
  promise_base
- dpp::basic_promise
  promise_base
- dpp::basic_promise
  release_awaiter
- dpp::basic_promise
  set_exception
- dpp::basic_promise
  set_value
- dpp::basic_promise
  set_value
- dpp::basic_promise
  state
- dpp::basic_promise
  storage_type
- dpp::basic_promise
  throw_if_not_empty
- dpp::basic_promise
  value