Home | Libraries | People | FAQ | More |
The future status of a scheduled asynchronous operation.
Other than the fact that
returns a get()
and T
returns a handle, the errored and excepted state for both is identical
and non-consuming for both.
get_handle()
Finally, note that there is a freely available type slice from
to future<T>
which moves/copies only the future<void>
part of the future<void>
,
leaving the future<T>
behind. This is because the AFIO engine resides behind a stable ABI layer
which cannot know anything about arbitrary types, and therefore it accepts
only T
.
Equally, this means you can supply a future<void>
as a precondition to another
op safe in the knowledge that any future<T>
part will remain untouched for later consumption.
T
template<class T, > class future { // ... };
Parameter |
Default |
Description |
---|---|---|
class T |
void |
|
Any returned result. Note this is defaulted to |
Function |
Description |
Parameters |
---|---|---|
future() |
||
future(dispatcher * parent, size_t id, shared_future< handle_ptr > handle, stl_future< T > result, bool check_handle = true, bool validate = true) |
dispatcher *: parent: The dispatcher this op belongs to. size_t: id: The unique non-zero id of this op. shared_future< handle_ptr >: handle: A shared_future to shared state between all instances of this reference. stl_future< T >: result: A future to any result from the operation. bool: check_handle: Whether to have validation additionally check if a handle is not null bool: validate: Whether to check the inputs and shared state for valid (and not errored) values |
|
future(future< void > && o, stl_future< T > && result) |
future< void > &&: o: The future<void> stl_future< T > &&: result: The future<T> to add |
Function |
Description |
Parameters |
Returns |
---|---|---|---|
bool valid(bool just_handle = false) |
True if this future is valid. |
bool: just_handle: |
|
T get() |
Waits for the future to become ready, returning any value or
rethrowing any exception found. Throws a |
||
template<class U> auto then(U && f) |
Schedules a callable to be invoked after this future becomes ready. If this future is null, use the current async file i/o dispatcher. |
U &&: f: |
#include <boost/afio/v2/afio.hpp>