27 XRT_FUTURE_STATE_PENDING,
28 XRT_FUTURE_STATE_READY,
29 XRT_FUTURE_STATE_CANCELLED,
49#define XRT_FUTURE_RESULT(TYPED_VALUE, ERR_CODE) \
50 XRT_C11_COMPOUND(struct xrt_future_result) \
52 .value = xrt_future_value_make(TYPED_VALUE), .result = ERR_CODE, \
200 if (old_dst == src) {
211 if (xrt_reference_dec_and_is_zero(&old_dst->
reference)) {
256 assert(xft && xft->
cancel);
270 assert(xft && xft->
wait);
271 return xft->
wait(xft, timeout);
299 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:196
enum xrt_result xrt_result_t
Result type used across Monado.
The (future) result of an asynchronous operation.
Definition: xrt_future.h:38
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:74
static 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:296
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.
Definition: xrt_future.h:226
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:181
xrt_result_t(* is_cancel_requested)(const struct xrt_future *xft, bool *out_request_cancel)
Waits on a cancelled future.
Definition: xrt_future.h:161
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:122
xrt_result_t(* wait)(struct xrt_future *xft, int64_t timeout_ns)
Waits on a pending/cancelled future.
Definition: xrt_future.h:147
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.
Definition: xrt_future.h:240
static xrt_result_t xrt_future_wait(struct xrt_future *xft, int64_t timeout)
Helper function for xrt_future::wait.
Definition: xrt_future.h:268
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:97
void(* destroy)(struct xrt_future *xft)
Destroys the future.
Definition: xrt_future.h:83
static xrt_result_t xrt_future_cancel(struct xrt_future *xft)
Helper function for xrt_future::cancel.
Definition: xrt_future.h:254
xrt_result_t(* cancel)(struct xrt_future *xft)
Signals an asynchronous operation associated with the future to cancel.
Definition: xrt_future.h:133
struct xrt_reference reference
Reference helper.
Definition: xrt_future.h:78
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.
Definition: xrt_future.h:282
A base class for reference counted objects.
Definition: xrt_defines.h:98
Common defines and enums for XRT.
xrt_future_state
The (future) status of an asynchronous operation.
Definition: xrt_future.h:26
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.