placeholder for the result of an asynchronous operation. More...
#include <future.hpp>
Public Types | |
typedef promise< T >::ptr | promise_ptr |
typedef T | value_type |
Public Member Functions | |
future (const promise_ptr &p=promise_ptr()) | |
future (const T &v) | |
void | cancel () |
bool | valid () const |
bool | ready () const |
bool | error () const |
operator const T & () const | |
const T & | wait (const microseconds &timeout=microseconds::max()) const |
const T & | wait_until (const system_clock::time_point &timeout) const |
A future is constructed with a promise that is created when a new asynchronous task is started. A future behaves like a shared pointer where all copies reffer to the same promise.
When future::wait() is called, the future will block the current task until one of three conditions are met:
If the asynchronous operation threw an exception it will be rethrown from the call to wait().
mace::cmt::future<T> automatically casts to type T when requested. This cast is short hand for mace::cmt::future<T>::wait().
Definition at line 174 of file future.hpp.