45#include "xtc_export.h"
52typedef struct xtc_future xtc_future_t;
53typedef struct xtc_promise xtc_promise_t;
62XTC_API
int xtc_future_new_pair(xtc_promise_t **out_prom,
63 xtc_future_t **out_fut);
76XTC_API
int xtc_promise_set(xtc_promise_t *prom, intptr_t value,
87XTC_API
void xtc_promise_drop(xtc_promise_t *prom);
100XTC_API
int xtc_future_await(xtc_future_t *fut, intptr_t *out);
111XTC_API
int xtc_future_wait(xtc_future_t *fut, intptr_t *out,
121XTC_API
int xtc_future_ready(xtc_future_t *fut,
int *is_ready);
130typedef intptr_t (*xtc_future_map_fn)(intptr_t value,
int status,
141XTC_API
int xtc_future_map(xtc_future_t *src, xtc_future_map_fn fn,
142 void *user, xtc_future_t **out_fut);
150typedef int (*xtc_future_then_fn)(intptr_t value,
int status,
void *user,
151 xtc_future_t **out_next);
160XTC_API
int xtc_future_then(xtc_future_t *src, xtc_future_then_fn fn,
161 void *user, xtc_future_t **out_fut);
172XTC_API
int xtc_future_when_all(xtc_future_t **futs,
int n,
173 xtc_future_t **out_fut);
182XTC_API
int xtc_future_when_any(xtc_future_t **futs,
int n,
183 xtc_future_t **out_fut);
193XTC_API
int xtc_future_with_timeout(xtc_future_t *src, int64_t timeout_ns,
194 xtc_future_t **out_fut);