MACE  1.0.0
 All Classes Namespaces Files Functions Variables Enumerations Defines
Public Types | Public Member Functions
mace::cmt::future< T > Class Template Reference

placeholder for the result of an asynchronous operation. More...

#include <future.hpp>

List of all members.

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

Detailed Description

template<typename T = void_t>
class mace::cmt::future< T >

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().

Automatic waiting on cast.

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.


The documentation for this class was generated from the following file: