|
Monado OpenXR Runtime
|
A future is a concurrency primitive that provides a mechanism to access results of asynchronous operations. More...
#include <xrt/xrt_future.h>


Static Public Member Functions | |
| static xrt_result_t | xrt_future_get_result (const struct xrt_future *xft, struct xrt_future_result *out_result) |
| Helper function for xrt_future::get_result. More... | |
| static xrt_result_t | xrt_future_get_state (const struct xrt_future *xft, enum xrt_future_state *out_state) |
| Helper function for xrt_future::get_state. More... | |
| static xrt_result_t | xrt_future_cancel (struct xrt_future *xft) |
| Helper function for xrt_future::cancel. More... | |
| static xrt_result_t | xrt_future_wait (struct xrt_future *xft, int64_t timeout) |
| Helper function for xrt_future::wait. More... | |
| static xrt_result_t | xrt_future_is_cancel_requested (const struct xrt_future *xft, bool *out_request_cancel) |
| Helper function for xrt_future::is_cancel_requested. More... | |
| static xrt_result_t | xrt_future_complete (struct xrt_future *xft, const struct xrt_future_result *ft_result) |
| Helper function for xrt_future::complete. More... | |
Data Fields | |
| struct xrt_reference | reference |
| Reference helper. More... | |
| void(* | destroy )(struct xrt_future *xft) |
| Destroys the future. More... | |
| xrt_result_t(* | get_state )(const struct xrt_future *xft, enum xrt_future_state *out_state) |
| Gets the current state of the future. More... | |
| xrt_result_t(* | get_result )(const struct xrt_future *xft, struct xrt_future_result *out_result) |
| Gets the future results (after async operation has finished) More... | |
| xrt_result_t(* | cancel )(struct xrt_future *xft) |
| Signals an asynchronous operation associated with the future to cancel. More... | |
| xrt_result_t(* | wait )(struct xrt_future *xft, int64_t timeout_ns) |
| Waits on a pending/cancelled future. More... | |
| xrt_result_t(* | is_cancel_requested )(const struct xrt_future *xft, bool *out_request_cancel) |
| Waits on a cancelled future. More... | |
| xrt_result_t(* | complete )(struct xrt_future *xft, const struct xrt_future_result *ft_result) |
| Signals that the asynchronous operation has completed and sets the future’s result. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| static void | xrt_future_reference (struct xrt_future **dst, struct xrt_future *src) |
| Update the reference counts on xrt_future(s). More... | |
A future is a concurrency primitive that provides a mechanism to access results of asynchronous operations.
The xrt_future interface shares similarities with OpenXR futures but is not identical. In comparison to C++ std::future, xrt_future combines concepts from both std::shared_future and std::promise with built-in cancellation support in a single interface. The interface provides separate method sets for producers (result generators) and consumers (result pollers/waiters).
Thread Safety and Reference Counting: Each thread that references an xrt_future must properly manage the reference count using xrt_future_reference when entering and exiting the thread's scope.
|
inlinestatic |
Helper function for xrt_future::cancel.
Signals an asynchronous operation associated with the future to cancel.
| [in] | xft | The future. |
References cancel.
|
inlinestatic |
Helper function for xrt_future::complete.
Signals that the asynchronous operation has completed and sets the future’s result.
| [in] | xft | The future. |
| [in] | ft_result | the result of an async operation associated with xft. |
References complete.
|
inlinestatic |
Helper function for xrt_future::get_result.
Gets the future results (after async operation has finished)
| [in] | xft | The future. |
| [out] | out_result | The future result of xft |
// std::future::get == xrt_future_wait(xft, INT64_MAX); xrt_get_result(xft, &my_result);
References get_result.
|
inlinestatic |
Helper function for xrt_future::get_state.
Gets the current state of the future.
| [in] | xft | The future. |
| [out] | out_state | The current state of xft |
References get_state.
|
inlinestatic |
Helper function for xrt_future::is_cancel_requested.
Waits on a cancelled future.
| [in] | xft | The future. |
| [out] | out_request_cancel | Has the consumer requested to cancel the async operation? |
References is_cancel_requested.
|
inlinestatic |
Helper function for xrt_future::wait.
Waits on a pending/cancelled future.
| [in] | xft | The future. |
| [in] | timeout_ns | Timeout in nanoseconds or INT64_MAX for infinite duration |
References wait.
| xrt_result_t(* xrt_future::cancel) (struct xrt_future *xft) |
Signals an asynchronous operation associated with the future to cancel.
| [in] | xft | The future. |
Referenced by xrt_future_cancel().
| xrt_result_t(* xrt_future::complete) (struct xrt_future *xft, const struct xrt_future_result *ft_result) |
Signals that the asynchronous operation has completed and sets the future’s result.
| [in] | xft | The future. |
| [in] | ft_result | the result of an async operation associated with xft. |
Referenced by xrt_future_complete().
| void(* xrt_future::destroy) (struct xrt_future *xft) |
Destroys the future.
Referenced by xrt_future_reference().
| xrt_result_t(* xrt_future::get_result) (const struct xrt_future *xft, struct xrt_future_result *out_result) |
Gets the future results (after async operation has finished)
| [in] | xft | The future. |
| [out] | out_result | The future result of xft |
// std::future::get == xrt_future_wait(xft, INT64_MAX); xrt_get_result(xft, &my_result);
Referenced by xrt_future_get_result().
| xrt_result_t(* xrt_future::get_state) (const struct xrt_future *xft, enum xrt_future_state *out_state) |
Gets the current state of the future.
| [in] | xft | The future. |
| [out] | out_state | The current state of xft |
Referenced by xrt_future_get_state().
| xrt_result_t(* xrt_future::is_cancel_requested) (const struct xrt_future *xft, bool *out_request_cancel) |
Waits on a cancelled future.
| [in] | xft | The future. |
| [out] | out_request_cancel | Has the consumer requested to cancel the async operation? |
Referenced by xrt_future_is_cancel_requested().
| struct xrt_reference xrt_future::reference |
Reference helper.
Referenced by xrt_future_reference().
| xrt_result_t(* xrt_future::wait) (struct xrt_future *xft, int64_t timeout_ns) |
Waits on a pending/cancelled future.
| [in] | xft | The future. |
| [in] | timeout_ns | Timeout in nanoseconds or INT64_MAX for infinite duration |
Referenced by xrt_future_wait().