28 XRT_FUTURE_STATE_PENDING,
29 XRT_FUTURE_STATE_READY,
30 XRT_FUTURE_STATE_CANCELLED,
50#define XRT_FUTURE_RESULT(TYPED_VALUE, ERR_CODE) \
51 XRT_C11_COMPOUND(struct xrt_future_result) \
53 .value = xrt_future_value_make(TYPED_VALUE), .result = ERR_CODE, \
201 if (old_dst == src) {
212 if (xrt_reference_dec_and_is_zero(&old_dst->
reference)) {
272 return xft->
wait(xft, timeout_ns);
300 return xft->
complete(xft, ft_result);
static void xrt_future_reference(struct xrt_future **dst, struct xrt_future *src)
Update the reference counts on xrt_future(s).
Definition: xrt_future.h:197
enum xrt_result xrt_result_t
Result type used across Monado.
The (future) result of an asynchronous operation.
Definition: xrt_future.h:39
XRT_ALIGNAS(8) xrt_result_t result
The error/ok status of a completed asynchronous operation.
Definition: xrt_future_value.h:46
A future is a concurrency primitive that provides a mechanism to access results of asynchronous opera...
Definition: xrt_future.h:75
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.
Definition: xrt_future.h:182
xrt_result_t(* is_cancel_requested)(const struct xrt_future *xft, bool *out_request_cancel)
Waits on a cancelled future.
Definition: xrt_future.h:162
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)
Definition: xrt_future.h:123
xrt_result_t(* wait)(struct xrt_future *xft, int64_t timeout_ns)
Waits on a pending/cancelled future.
Definition: xrt_future.h:148
static XRT_NONNULL_ALL xrt_result_t xrt_future_cancel(struct xrt_future *xft)
Helper function for xrt_future::cancel.
Definition: xrt_future.h:255
static XRT_NONNULL_ALL 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.
Definition: xrt_future.h:227
static XRT_NONNULL_ALL 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.
Definition: xrt_future.h:241
static XRT_NONNULL_ALL xrt_result_t xrt_future_complete(struct xrt_future *xft, const struct xrt_future_result *ft_result)
Helper function for xrt_future::complete.
Definition: xrt_future.h:297
xrt_result_t(* get_state)(const struct xrt_future *xft, enum xrt_future_state *out_state)
Gets the current state of the future.
Definition: xrt_future.h:98
static XRT_NONNULL_ALL xrt_result_t xrt_future_wait(struct xrt_future *xft, int64_t timeout_ns)
Helper function for xrt_future::wait.
Definition: xrt_future.h:269
void(* destroy)(struct xrt_future *xft)
Destroys the future.
Definition: xrt_future.h:84
xrt_result_t(* cancel)(struct xrt_future *xft)
Signals an asynchronous operation associated with the future to cancel.
Definition: xrt_future.h:134
struct xrt_reference reference
Reference helper.
Definition: xrt_future.h:79
static XRT_NONNULL_ALL 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.
Definition: xrt_future.h:283
A base class for reference counted objects.
Definition: xrt_defines.h:99
Common defines and enums for XRT.
xrt_future_state
The (future) status of an asynchronous operation.
Definition: xrt_future.h:27
enum xrt_future_state xrt_future_state_t
The (future) status of an asynchronous operation.
Variant/algebraic data-type for holding the values of xrt_futures.