odyssey/lib/ft.h

31 lines
412 B
C
Raw Normal View History

2016-11-08 12:14:48 +00:00
#ifndef FT_H_
#define FT_H_
/*
2016-11-08 14:53:52 +00:00
* flint.
2016-11-08 12:14:48 +00:00
*
* Cooperative multitasking engine.
*/
typedef struct ft ft;
struct ft {
int online;
ftscheduler scheduler;
uv_loop_t loop;
uv_async_t async;
};
static inline ftfiber*
ft_current(ft *f) {
return f->scheduler.current;
}
static inline void
ft_wakeup(ft *f, ftfiber *fiber) {
ft_scheduler_set(fiber, FT_FREADY);
uv_async_send(&f->async);
}
#endif