44#include "xtc_export.h"
51typedef struct xtc_future xtc_future_t;
52typedef struct xtc_promise xtc_promise_t;
61XTC_API
int xtc_future_new_pair(xtc_promise_t **out_prom,
62 xtc_future_t **out_fut);
75XTC_API
int xtc_promise_set(xtc_promise_t *prom, intptr_t value,
86XTC_API
void xtc_promise_drop(xtc_promise_t *prom);
99XTC_API
int xtc_future_await(xtc_future_t *fut, intptr_t *out);
110XTC_API
int xtc_future_wait(xtc_future_t *fut, intptr_t *out,
120XTC_API
int xtc_future_ready(xtc_future_t *fut,
int *is_ready);
129typedef intptr_t (*xtc_future_map_fn)(intptr_t value,
int status,
140XTC_API
int xtc_future_map(xtc_future_t *src, xtc_future_map_fn fn,
141 void *user, xtc_future_t **out_fut);
149typedef int (*xtc_future_then_fn)(intptr_t value,
int status,
void *user,
150 xtc_future_t **out_next);
159XTC_API
int xtc_future_then(xtc_future_t *src, xtc_future_then_fn fn,
160 void *user, xtc_future_t **out_fut);
171XTC_API
int xtc_future_when_all(xtc_future_t **futs,
int n,
172 xtc_future_t **out_fut);
181XTC_API
int xtc_future_when_any(xtc_future_t **futs,
int n,
182 xtc_future_t **out_fut);
192XTC_API
int xtc_future_with_timeout(xtc_future_t *src, int64_t timeout_ns,
193 xtc_future_t **out_fut);