State of the async and its callback. More...
#include "async.h"
Public Member Functions | |
~async_callback_data () | |
Destructor. More... | |
template<typename... Ts> | |
void | construct_result (Ts &&... ts) |
Convenience function to construct the result in the storage and initialize its lifetime. More... | |
Public Attributes | |
std_coroutine::coroutine_handle | coro_handle = nullptr |
Handle to the coroutine co_await-ing on this API call. More... | |
std::atomic< int > | ref_count {1} |
Number of references to this callback state. More... | |
std::array< std::byte, sizeof(R)> | result_storage |
The stored result of the API call, stored as an array of bytes to directly construct in place. More... | |
std::atomic< state_t > | state = state_t::sent |
State of the awaitable and the API callback. More... | |
State of the async and its callback.
Defined outside of dpp::async because this seems to work better with Intellisense.
|
inline |
Destructor.
Also destroys the result if present.
References dpp::detail::async::done, dpp::detail::async::async_callback_data< R >::result_storage, and dpp::detail::async::async_callback_data< R >::state.
|
inline |
Convenience function to construct the result in the storage and initialize its lifetime.
References dpp::detail::async::async_callback_data< R >::result_storage.
std_coroutine::coroutine_handle dpp::detail::async::async_callback_data< R >::coro_handle = nullptr |
Handle to the coroutine co_await-ing on this API call.
std::atomic<int> dpp::detail::async::async_callback_data< R >::ref_count {1} |
Number of references to this callback state.
std::array<std::byte, sizeof(R)> dpp::detail::async::async_callback_data< R >::result_storage |
The stored result of the API call, stored as an array of bytes to directly construct in place.
Referenced by dpp::detail::async::async_callback_data< R >::construct_result(), and dpp::detail::async::async_callback_data< R >::~async_callback_data().
std::atomic<state_t> dpp::detail::async::async_callback_data< R >::state = state_t::sent |
State of the awaitable and the API callback.
Referenced by dpp::detail::async::async_callback_data< R >::~async_callback_data().