#include <legion.h>
Public Member Functions | |
Future (const Future &f) | |
Future (Future &&f) | |
bool | operator== (const Future &f) const |
bool | operator< (const Future &f) const |
Future & | operator= (const Future &f) |
Future & | operator= (Future &&f) |
template<typename T > | |
T | get_result (bool silence_warnings=false, const char *warning_string=NULL) const |
void | get_void_result (bool silence_warnings=false, const char *warning_string=NULL) const |
bool | is_empty (bool block=false, bool silence_warnings=false, const char *warning_string=NULL) const |
bool | is_ready (bool subscribe=false) const |
template<typename T > | |
const T & | get_reference (bool silence_warnings=false, const char *warning_string=NULL) const |
const void * | get_untyped_pointer (bool silence_warnings=false, const char *warning_string=NULL) const |
size_t | get_untyped_size (void) const |
template<typename T > | |
T | get (void) |
bool | valid (void) const |
void | wait (void) const |
![]() | |
size_t | legion_buffer_size (void) |
size_t | legion_serialize (void *buffer) |
size_t | legion_deserialize (const void *buffer) |
Static Public Member Functions | |
template<typename T > | |
static Future | from_value (Runtime *rt, const T &value) |
static Future | from_untyped_pointer (Runtime *rt, const void *buffer, size_t bytes) |
Protected Member Functions | |
FRIEND_ALL_RUNTIME_CLASSES | Future (Internal::FutureImpl *impl, bool need_reference=true) |
Futures are the objects returned from asynchronous task launches. Applications can wait on futures to get their values, pass futures as arguments and preconditions to other tasks, or use them to create predicates if they are boolean futures. Futures are lightweight handles that can be passed by value or stored in data structures. However, futures should not escape the context in which they are created as the runtime garbage collects them after the enclosing task context completes execution.
Since futures can be the result of predicated tasks we also provide a mechanism for checking whether the future contains an empty result. An empty future will be returned for all futures which come from tasks which predicates that resolve to false.
|
inlinestatic |
Generates a future from an untyped pointer. No serialization is performed.
|
inlinestatic |
Allow users to generate their own futures. These futures are guaranteed to always have completed and to always have concrete values.
|
inline |
Return a const reference to the future. WARNING: these method is unsafe as the underlying buffer containing the future result can be deleted if the Future handle is lost even a reference to the underlying buffer is maitained. This scenario can lead to seg-faults. Use at your own risk. Note also that this call will not properly deserialize buffers that were serialized with a 'legion_serialize' method.
silence_warnings | silence any warnings for this blocking call |
warning_string | a string to be reported with the warning |
|
inline |
Wait on the result of this future. Return the value of the future as the specified template type.
silence_warnings | silence any warnings for this blocking call |
warning_string | a string to be reported with the warning |
|
inline |
Return an untyped pointer to the future result. WARNING: this method is unsafe for the same reasons as get_reference. It also will not deserialize anything serialized with a legion_serialize method.
silence_warnings | silence any warnings for this blocking call |
warning_string | a string to be reported with the warning |
size_t Legion::Future::get_untyped_size | ( | void | ) | const |
Return the number of bytes contained in the future.
void Legion::Future::get_void_result | ( | bool | silence_warnings = false , |
const char * | warning_string = NULL |
||
) | const |
Block until the future completes.
silence_warnings | silence any warnings for this blocking call |
warning_string | a string to be reported with the warning |
bool Legion::Future::is_empty | ( | bool | block = false , |
bool | silence_warnings = false , |
||
const char * | warning_string = NULL |
||
) | const |
Check to see if the future is empty. The user can specify whether to block and wait for the future to complete first before returning. If the non-blocking version of the call will return true, until the future actually completes.
block | indicate whether to block for the result |
silence_warnings | silence any warnings for this blocking call |
warning_string | a string to be reported with the warning |
bool Legion::Future::is_ready | ( | bool | subscribe = false | ) | const |
Check to see if the future is ready. This will return true if the future can be used without blocking to wait on the computation that the future represents, otherwise it will return false.
subscribe | ask for the payload to be brought here when ready |