BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
a placeholder for the result of an asynchronous operation. More...
#include <future.hpp>
Public Member Functions | |
future (const typename promise< T >::ptr &p) | |
future (typename promise< T >::ptr &&p) | |
future (const future< T > &f) | |
future () | |
future & | operator= (future< T > &&f) |
operator const T & () const | |
const T & | wait (const microseconds &timeout=microseconds::maximum()) const |
const T & | wait_until (const time_point &tp) const |
bool | valid () const |
bool | ready () const |
bool | error () const |
void | cancel (const char *reason FC_CANCELATION_REASON_DEFAULT_ARG) const |
bool | canceled () const |
void | cancel_and_wait (const char *reason FC_CANCELATION_REASON_DEFAULT_ARG) |
template<typename CompletionHandler > | |
void | on_complete (CompletionHandler &&c) |
Friends | |
class | thread |
a placeholder for the result of an asynchronous operation.
By calling future<T>::wait() you will block the current fiber until the asynchronous operation completes.
If you would like to use an asynchronous interface instead of the synchronous 'wait' method you could specify a CompletionHandler which is a method that takes two parameters, a const reference to the value and an exception_ptr. If the exception_ptr is set, the value reference is invalid and accessing it is 'undefined'.
Promises have pointer semantics, futures have reference semantics that contain a shared pointer to a promise.
Definition at line 211 of file future.hpp.
|
inline |
Definition at line 213 of file future.hpp.
|
inline |
Definition at line 214 of file future.hpp.
|
inline |
Definition at line 215 of file future.hpp.
|
inline |
Definition at line 216 of file future.hpp.
|
inline |
Definition at line 248 of file future.hpp.
|
inline |
Definition at line 251 of file future.hpp.
|
inline |
Definition at line 249 of file future.hpp.
|
inline |
Definition at line 246 of file future.hpp.
|
inline |
The given completion handler will be called from some arbitrary thread and should not 'block'. Generally it should post an event or start a new async operation.
Definition at line 274 of file future.hpp.
|
inline |
Definition at line 223 of file future.hpp.
|
inline |
Definition at line 218 of file future.hpp.
|
inline |
Definition at line 243 of file future.hpp.
|
inline |
Definition at line 240 of file future.hpp.
|
inline |
timeout |
Definition at line 228 of file future.hpp.
|
inline |
timeout |
Definition at line 235 of file future.hpp.
|
friend |
Definition at line 278 of file future.hpp.