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 129 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 245 of file future.hpp.
engine::Promise< T >::~Promise | ( | ) |
Definition at line 256 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 267 of file future.hpp.
|
noexcept |
Definition at line 248 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 282 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 272 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 277 of file future.hpp.