2#define REDUCT_FUTURE_H 1
21#define REDUCT_FUTURE_SMALL_MAX 2
27typedef struct reduct_future
62 if (!atomic_load_explicit(&future->done, memory_order_acquire))
84 assert(reduct != NULL);
85 assert(future != NULL);
89 return atomic_load_explicit(&future->done, memory_order_relaxed);
#define REDUCT_UNLIKELY(_x)
#define REDUCT_ALWAYS_INLINE
#define REDUCT_UNUSED(_x)
#define REDUCT_ERROR_RETHROW(_reduct, _error)
Rethrow an existing error.
static REDUCT_ALWAYS_INLINE reduct_handle_t reduct_future_join(struct reduct *reduct, reduct_future_t *future)
Wait for the future to complete and return its result.
REDUCT_API reduct_future_t * reduct_future_new(struct reduct *reduct, reduct_handle_t callable, size_t argc, reduct_handle_t *argv)
Create a new future and start its execution.
#define REDUCT_FUTURE_SMALL_MAX
The maximum number of small arguments in a future.
static REDUCT_ALWAYS_INLINE bool reduct_future_is_done(struct reduct *reduct, reduct_future_t *future)
Check if the future is finished.
REDUCT_API void reduct_task_join(struct reduct *reduct, reduct_task_id_t id)
Wait for a task to finish.
reduct_handle_t callable
The callable to execute.
reduct_handle_t * argv
The arguments for the callable.
reduct_error_t * error
Error structure, will be NULL if no error occured.
_Atomic(bool) done
Whether the future is finished.
reduct_task_id_t taskId
The task ID in the task system.
uint32_t argc
The number of arguments.
reduct_handle_t result
The result of the execution.