16#include "xtc_export.h"
30typedef intptr_t (*xtc_coro_fn)(
void *arg);
50XTC_API
int xtc_async(xtc_loop_t *loop, xtc_coro_fn fn,
void *arg,
51 xtc_task_t **out_task);
61XTC_API
int xtc_await(xtc_task_t *t, intptr_t *result);
68XTC_API
void xtc_yield(
void);
81XTC_API
void xtc_yield_set_budget(xtc_loop_t *loop, int64_t budget_ns);
82XTC_API
int xtc_yield_check(
void);
83XTC_API
int xtc_yield_if_due(
void);
84XTC_API uint64_t xtc_yield_due_count(
const xtc_loop_t *loop);
90XTC_API
size_t xtc_stack_size(
void);
91XTC_API
int xtc_set_stack_size(
size_t bytes);
119XTC_API
int xtc_stack_reclaim_enable(
size_t keep_bytes);
120XTC_API
void xtc_stack_reclaim_disable(
void);
121XTC_API
int xtc_stack_reclaim_enabled(
void);
122XTC_API uint64_t xtc_stack_reclaim_count(
void);
134#define XTC_COOP_REGION
141typedef struct xtc_pt {
145#define XTC_PT_THREAD(...) char __VA_ARGS__
146#define XTC_PT_INIT(pt) ((pt)->lc = 0)
147#define XTC_PT_BEGIN(pt) switch ((pt)->lc) { case 0:
148#define XTC_PT_END(pt) } (pt)->lc = 0; return 2
149#define XTC_PT_YIELD(pt) do { \
150 (pt)->lc = __LINE__; return 0 ; \
151 case __LINE__:; } while (0)
152#define XTC_PT_WAIT_UNTIL(pt, c) do { \
153 (pt)->lc = __LINE__; case __LINE__: \
154 if (!(c)) return 0; } while (0)
157#define XTC_PT_YIELDED 0