std::promise replacement for asynchronous tasks that works in pair with engine::Future
engine::Promise can be used both from coroutines and from non-coroutine threads.
Definition at line 122 of file future.hpp.
Public Member Functions | |
Promise () | |
Creates a new asynchronous value store. | |
Promise (const Promise &)=delete | |
Promise (Promise &&) noexcept=default | |
Promise & | operator= (const Promise &)=delete |
Promise & | operator= (Promise &&) noexcept |
Future< T > | get_future () |
void | set_value (const T &) |
void | set_value (T &&) |
void | set_exception (std::exception_ptr ex) |
engine::Promise< T >::Promise | ( | ) |
Creates a new asynchronous value store.
Definition at line 235 of file future.hpp.
engine::Promise< T >::~Promise | ( | ) |
Definition at line 246 of file future.hpp.
Future< T > engine::Promise< T >::get_future | ( | ) |
Retrieves the Future associated with this value store.
std::future_error | if the Future has already been retrieved. |
Definition at line 258 of file future.hpp.
|
noexcept |
Definition at line 238 of file future.hpp.
void engine::Promise< T >::set_exception | ( | std::exception_ptr | ex | ) |
Stores an exception to be thrown on retrieval.
std::future_error | if a value or an exception has already been set. |
Definition at line 273 of file future.hpp.
void engine::Promise< T >::set_value | ( | const T & | value | ) |
Stores a value for retrieval.
std::future_error | if a value or an exception has already been set. |
Definition at line 263 of file future.hpp.
void engine::Promise< T >::set_value | ( | T && | value | ) |
Stores a value for retrieval.
std::future_error | if a value or an exception has already been set. |
Definition at line 268 of file future.hpp.