Seastar
High performance C++ framework for concurrent servers
|
promise - allows a future value to be made available at a later time.
T | A list of types to be carried as the result of the associated future. A list with two or more types is deprecated; use promise<std::tuple<T...>> instead. |
#include <seastar/core/future.hh>
Public Member Functions | |
promise () noexcept | |
Constructs an empty promise . More... | |
void | move_it (promise &&x) noexcept |
Moves a promise object. | |
promise (promise &&x) noexcept | |
promise (const promise &)=delete | |
promise & | operator= (promise &&x) noexcept |
void | operator= (const promise &)=delete |
void | set_to_current_exception () noexcept |
future< T > | get_future () noexcept |
Gets the promise's associated future. More... | |
template<typename... A> | |
void | set_value (A &&... a) noexcept |
Sets the promises value. More... | |
void | set_exception (std::exception_ptr &&ex) noexcept |
Marks the promise as failed. More... | |
void | set_exception (const std::exception_ptr &ex) noexcept |
template<typename Exception > | |
std::enable_if_t<!std::is_same_v< std::remove_reference_t< Exception >, std::exception_ptr >, void > | set_exception (Exception &&e) noexcept |
Marks the promise as failed. More... | |
|
inlinenoexcept |
Constructs an empty promise
.
Creates promise with no associated future yet (see get_future()).
|
inlinenoexcept |
Marks the promise as failed.
Forwards the exception argument to the future and makes it available. May be called either before or after get_future()
.
|
inlinenoexcept |
Marks the promise as failed.
Forwards the exception argument to the future and makes it available. May be called either before or after get_future()
.
|
inlinenoexcept |
Set this promise to the current exception.
This is equivalent to set_exception(std::current_exception()), but expands to less code.
|
inlinenoexcept |
Sets the promises value.
Forwards the arguments and makes them available to the associated future. May be called either before or after get_future()
.
The arguments can have either the types the promise is templated with, or a corresponding std::tuple. That is, given a promise<int, double>, both calls are valid:
pr.set_value(42, 43.0); pr.set_value(std::tuple<int, double>(42, 43.0))