dpp::awaitable
dpp::basic_awaitable< awaitable< T > >
awaitable.h
dpp::awaitable::awaiter
typename T
T using dpp::awaitable< T >::result_type = T result_type dpp::awaitable::result_type

The type of the result produced by this task.

detail::promise::promise_base< T > using dpp::awaitable< T >::shared_state = detail::promise::promise_base<T> shared_state dpp::awaitable::shared_state
detail::promise::state_flags using dpp::awaitable< T >::state_flags = detail::promise::state_flags state_flags dpp::awaitable::state_flags
class friend class detail::promise::promise_base< T > detail::promise::promise_base< T > dpp::awaitable::promise_base< T > detail::promise::promise_base< T >
typename Derived
awaiter< Derived && > awaiter< Derived && > operator co_await (Derived &&obj) noexcept operator co_await dpp::awaitable::operator co_await Derived && obj (std::is_base_of_v<awaitable, std::remove_cv_t<Derived>>)

Overload of the co_await operator. Returns an awaiter referencing this awaitable.

Returns an awaiter referencing this awaitable.

typename Derived
awaiter< Derived & > awaiter< Derived & > operator co_await (Derived &obj) noexcept operator co_await dpp::awaitable::operator co_await Derived & obj (std::is_base_of_v<awaitable, std::remove_cv_t<Derived>>)

Overload of the co_await operator.

Returns an awaiter referencing this awaitable.

shared_state * shared_state* dpp::awaitable< T >::state_ptr state_ptr dpp::awaitable::state_ptr = nullptr

Non-owning pointer to the promise, which must be kept alive for the entire lifetime of the awaitable.

dpp::awaitable< T >::awaitable
(shared_state *promise) noexcept
awaitable
dpp::awaitable::awaitable
shared_state * promise

Construct from a promise.

promise

The promise to refer to.

uint8_t auto dpp::awaitable< T >::abandon () abandon dpp::awaitable::abandon

Abandons the promise.

Set the promise's state to broken and unlinks this awaitable.

uint8_t Flags previously held before setting them to broken

auto auto dpp::basic_awaitable< Derived >::sync_wait_impl (auto &&do_wait) sync_wait_impl dpp::basic_awaitable< awaitable< T > >::sync_wait_impl auto && do_wait

Implementation for sync_wait. This is code used by sync_wait, sync_wait_for, sync_wait_until.

Timed

Whether the wait function times out or not

do_wait

Function to do the actual wait on the cv

If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.

If T is non-void, returns a std::optional<T> for which an absence of value means timed out.

dpp::awaitable< T >::awaitable
()=default
awaitable
dpp::awaitable::awaitable

Construct an empty awaitable.

Such an awaitable must be assigned a promise before it can be awaited.

dpp::awaitable< T >::awaitable
(awaitable &&rhs) noexcept
awaitable
dpp::awaitable::awaitable
awaitable && rhs

Move from another awaitable.

rhs

The awaitable to move from, left in an unspecified state after this.

dpp::awaitable< T >::awaitable
(const awaitable &)=delete
awaitable
dpp::awaitable::awaitable
const awaitable &

Copy construction is disabled.

dpp::awaitable< T >::~awaitable
()
~awaitable
dpp::awaitable::~awaitable

Destructor.

May signal to the promise that it was destroyed.

bool bool dpp::awaitable< T >::await_ready () const await_ready dpp::awaitable::await_ready

Check whether or not co_await-ing this would suspend the caller, i.e. if we have the result or not.

bool Whether we already have the result or not

void void dpp::awaitable< T >::if_this_causes_an_invalid_read_your_promise_was_destroyed_before_your_awaitable____check_your_promise_lifetime () if_this_causes_an_invalid_read_your_promise_was_destroyed_before_your_awaitable____check_your_promise_lifetime dpp::awaitable::if_this_causes_an_invalid_read_your_promise_was_destroyed_before_your_awaitable____check_your_promise_lifetime

Title :).

We use this in the destructor

awaitable & awaitable & dpp::awaitable< T >::operator= (awaitable &&rhs) noexcept operator= dpp::awaitable::operator= awaitable && rhs

Move from another awaitable.

rhs

The awaitable to move from, left in an unspecified state after this.

*this

awaitable & awaitable & dpp::awaitable< T >::operator= (const awaitable &)=delete operator= dpp::awaitable::operator= const awaitable &

Copy assignment is disabled.

auto auto dpp::basic_awaitable< Derived >::sync_wait () sync_wait dpp::basic_awaitable< awaitable< T > >::sync_wait

Blocks this thread and waits for the awaitable to finish.

This will BLOCK THE THREAD. It is likely you want to use co_await instead.

If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.

If T is non-void, returns a std::optional<T> for which an absence of value means timed out.

auto auto dpp::basic_awaitable< Derived >::sync_wait_for (const std::chrono::duration< Rep, Period > &duration) sync_wait_for dpp::basic_awaitable< awaitable< T > >::sync_wait_for const std::chrono::duration< Rep, Period > & duration

Blocks this thread and waits for the awaitable to finish.

This will BLOCK THE THREAD. It is likely you want to use co_await instead.

duration

Maximum duration to wait for

If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.

If T is non-void, returns a std::optional<T> for which an absence of value means timed out.

auto auto dpp::basic_awaitable< Derived >::sync_wait_until (const std::chrono::time_point< Clock, Duration > &time) sync_wait_until dpp::basic_awaitable< awaitable< T > >::sync_wait_until const std::chrono::time_point< Clock, Duration > & time

Blocks this thread and waits for the awaitable to finish.

This will BLOCK THE THREAD. It is likely you want to use co_await instead.

time

Maximum time point to wait for

If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.

If T is non-void, returns a std::optional<T> for which an absence of value means timed out.

bool bool dpp::awaitable< T >::valid () const noexcept valid dpp::awaitable::valid

Check whether this awaitable refers to a valid promise.

bool Whether this awaitable refers to a valid promise or not

Generic awaitable class, represents a future value that can be co_await-ed on.

Roughly equivalent of std::future for coroutines, with the crucial distinction that the future does not own a reference to a "shared state". It holds a non-owning reference to the promise, which must be kept alive for the entire lifetime of the awaitable.

T

Type of the asynchronous value

promise

dpp::async< R >
dpp::awaitable< R >
< R >
dpp::awaitable< T >
dpp::basic_awaitable< Derived >
dpp::basic_awaitable< awaitable< T > >
< awaitable< T > >
dpp::task< R >
T
dpp::awaitable< T >
state_ptr
dpp::basic_awaitable< Derived >
dpp::basic_awaitable< awaitable< T > >
< awaitable< 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::awaitable
  abandon
- dpp::awaitable
  await_ready
- dpp::awaitable
  awaitable
- dpp::awaitable
  awaitable
- dpp::awaitable
  awaitable
- dpp::awaitable
  awaitable
- dpp::awaitable
  detail::promise::promise_base< T >
- dpp::awaitable
  if_this_causes_an_invalid_read_your_promise_was_destroyed_before_your_awaitable____check_your_promise_lifetime
- dpp::awaitable
  operator co_await
- dpp::awaitable
  operator co_await
- dpp::awaitable
  operator=
- dpp::awaitable
  operator=
- dpp::awaitable
  result_type
- dpp::awaitable
  shared_state
- dpp::awaitable
  state_flags
- dpp::awaitable
  state_ptr
- dpp::awaitable
  sync_wait
- dpp::awaitable
  sync_wait_for
- dpp::awaitable
  sync_wait_impl
- dpp::awaitable
  sync_wait_until
- dpp::awaitable
  valid
- dpp::awaitable
  ~awaitable