13#include "xtc_export.h"
33typedef int (*xtc_task_fn)(xtc_task_t *self,
void *user);
35#define XTC_TASK_DONE 0
36#define XTC_TASK_RESCHED 1
37#define XTC_TASK_PENDING 2
44typedef struct xtc_waker {
50typedef void (*xtc_timer_fn)(
void *user);
69XTC_API
int xtc_loop_init(xtc_loop_t **out);
70XTC_API
int xtc_loop_fini(xtc_loop_t *loop);
71XTC_API
int xtc_loop_run(xtc_loop_t *loop);
72XTC_API
int xtc_loop_stop(xtc_loop_t *loop);
102XTC_API
int xtc_loop_wake(xtc_loop_t *loop);
112XTC_API
struct xtc_res *xtc_loop_res(xtc_loop_t *loop);
114XTC_API
int xtc_task_spawn(xtc_loop_t *loop, xtc_task_fn fn,
void *user,
115 xtc_task_t **out_task);
116XTC_API
int xtc_task_waker(xtc_task_t *task,
xtc_waker_t *out);
122XTC_API
int xtc_task_park_on_timer(xtc_task_t *self, int64_t delay_ns);
133XTC_API
int xtc_task_park_on_fd(xtc_task_t *self,
int fd, uint32_t interest);
137XTC_API
int xtc_timer_set(xtc_loop_t *loop, int64_t delay_ns,
138 xtc_timer_fn fn,
void *user, xtc_timer_t **out_timer);
139XTC_API
int xtc_timer_cancel(xtc_timer_t *timer);