14#include "xtc_export.h"
34typedef int (*xtc_task_fn)(xtc_task_t *self,
void *user);
36#define XTC_TASK_DONE 0
37#define XTC_TASK_RESCHED 1
38#define XTC_TASK_PENDING 2
45typedef struct xtc_waker {
51typedef void (*xtc_timer_fn)(
void *user);
71XTC_API
int xtc_loop_init(xtc_loop_t **out);
72XTC_API
int xtc_loop_fini(xtc_loop_t *loop);
73XTC_API
int xtc_loop_run(xtc_loop_t *loop);
74XTC_API
int xtc_loop_stop(xtc_loop_t *loop);
104XTC_API
int xtc_loop_wake(xtc_loop_t *loop);
114XTC_API
struct xtc_res *xtc_loop_res(xtc_loop_t *loop);
116XTC_API
int xtc_task_spawn(xtc_loop_t *loop, xtc_task_fn fn,
void *user,
117 xtc_task_t **out_task);
118XTC_API
int xtc_task_waker(xtc_task_t *task,
xtc_waker_t *out);
124XTC_API
int xtc_task_park_on_timer(xtc_task_t *self, int64_t delay_ns);
135XTC_API
int xtc_task_park_on_fd(xtc_task_t *self,
int fd, uint32_t interest);
139XTC_API
int xtc_timer_set(xtc_loop_t *loop, int64_t delay_ns,
140 xtc_timer_fn fn,
void *user, xtc_timer_t **out_timer);
141XTC_API
int xtc_timer_cancel(xtc_timer_t *timer);
152XTC_API
int xtc_timer_release(xtc_timer_t *timer);