diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-11-25 15:11:20 +0200 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-11-25 15:11:20 +0200 |
commit | 2b19cc385163a43b1d559074a795a8aaab751185 (patch) | |
tree | 322473e3446153c1bbaac8d6d990734b09d15977 /include/libtf/fiber.h | |
parent | fc1044daf51f32b9d85f8497e4e0bd5a3c1e7fe9 (diff) | |
download | libtf-2b19cc385163a43b1d559074a795a8aaab751185.tar.bz2 libtf-2b19cc385163a43b1d559074a795a8aaab751185.tar.xz |
libtf: implement basic networking i/o
pretty much untested. also some slight changes to how scheduler is
invoked.
Diffstat (limited to 'include/libtf/fiber.h')
-rw-r--r-- | include/libtf/fiber.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/libtf/fiber.h b/include/libtf/fiber.h index 91c0b3b..36c2812 100644 --- a/include/libtf/fiber.h +++ b/include/libtf/fiber.h @@ -28,6 +28,10 @@ #define TF_WAKEUP_TIMEOUT ETIMEDOUT #define TF_WAKEUP_FD EIO +/* Special timeouts for tf_schedule() */ +#define TF_NO_TIMEOUT -1 +#define TF_NO_TIMEOUT_CHANGE -2 + /* Scheduler */ struct tf_fiber; @@ -77,11 +81,14 @@ void tf_fiber_put(void *data); void tf_exit(void) attribute_noreturn; void tf_kill(void *fiber); -int tf_schedule(int wakeup_type); -int tf_schedule_timeout(int milliseconds); +int tf_schedule(int milliseconds); void tf_wakeup(struct tf_fiber *fiber, int wakeup_type); - int tf_yield(void); -int tf_msleep(int milliseconds); + +static inline +int tf_msleep(int milliseconds) +{ + return tf_schedule(milliseconds); +} #endif |