dpp::async
dpp::awaitable< R >
coro/async.h
typename R
R using dpp::async< R >::result_type = R result_type dpp::async::result_type

The return type of the API call. Defaults to confirmation_callback_t.

detail::async::callback< R > detail::async::callback<R> dpp::async< R >::api_callback api_callback dpp::async::api_callback {}

Callable object to pass to API calls.

dpp::async< R >::async
(std::shared_ptr< basic_promise< R > > &&promise)
async
dpp::async::async
std::shared_ptr< basic_promise< R > > && promise

Internal promise constructor, grabs a promise object for the callback to use.

dpp::async< R >::async
(async &&)=default
async
dpp::async::async
async &&

Move constructor, moves the awaitable async object.

dpp::async< R >::async
(const async &)=delete
async
dpp::async::async
const async &

Copy constructor is disabled.

typename Fun
typename... Args Args
dpp::async< R >::async
(Fun &&fun, Args &&... args)
async
dpp::async::async
Fun && fun
Args &&... args

Construct an async object wrapping an invokeable object, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result.

fun

The object to call using std::invoke. Its last parameter must be a callable taking a parameter of type R

args

Parameters to pass to the object, excluding the callback

typename Obj
typename Fun
typename... Args Args
dpp::async< R >::async
(Obj &&obj, Fun &&fun, Args &&... args)
async
dpp::async::async
Obj && obj
Fun && fun
Args &&... args

Construct an async object wrapping an object method, the call is made immediately by forwarding to std::invoke and can be awaited later to retrieve the result.

obj

The object to call the method on

fun

The method of the object to call. Its last parameter must be a callback taking a parameter of type R

args

Parameters to pass to the method, excluding the callback

dpp::async< R >::~async
()
~async
dpp::async::~async

Destructor, signals to the callback that the async object is gone and shouldn't be notified of the result.

bool bool dpp::awaitable< R >::await_ready () const await_ready dpp::awaitable< R >::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< R >::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< R >::if_this_causes_an_invalid_read_your_promise_was_destroyed_before_your_awaitable____check_your_promise_lifetime

Title :).

We use this in the destructor

async & async & dpp::async< R >::operator= (async &&)=default operator= dpp::async::operator= async &&

Move assignment operator, moves the awaitable async object.

async & async & dpp::async< R >::operator= (const async &)=delete operator= dpp::async::operator= const async &

Copy assignment operator is disabled.

auto auto dpp::basic_awaitable< Derived >::sync_wait () sync_wait dpp::basic_awaitable< awaitable< R > >::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< R > >::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< R > >::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< R >::valid () const noexcept valid dpp::awaitable< R >::valid

Check whether this awaitable refers to a valid promise.

bool Whether this awaitable refers to a valid promise or not

detail::promise::promise_base< R > using dpp::awaitable< R >::shared_state = shared_state dpp::awaitable< R >::shared_state
detail::promise::state_flags using dpp::awaitable< R >::state_flags = state_flags dpp::awaitable< R >::state_flags
shared_state * shared_state* dpp::awaitable< R >::state_ptr state_ptr dpp::awaitable< R >::state_ptr

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

uint8_t auto dpp::awaitable< R >::abandon () abandon dpp::awaitable< R >::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< R > >::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.

A co_await-able object handling an API call in parallel with the caller.

This class is the return type of the dpp::cluster::co_* methods, but it can also be created manually to wrap any async call.

- The coroutine may be resumed in another thread, do not rely on thread_local variables.

- This feature is EXPERIMENTAL. The API may change at any time and there may be bugs. Please report any to GitHub issues or to the D++ Discord server.

R

The return type of the API call. Defaults to confirmation_callback_t

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