diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-11-25 16:53:02 +0200 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-11-25 16:53:02 +0200 |
commit | 4db830052d941d9c6de281bc9a2f6ac212c59ad8 (patch) | |
tree | 3a9b5e7c78a812fc582f8844703069e5692a0c94 /include/libtf/fiber.h | |
parent | 2b19cc385163a43b1d559074a795a8aaab751185 (diff) | |
download | libtf-4db830052d941d9c6de281bc9a2f6ac212c59ad8.tar.bz2 libtf-4db830052d941d9c6de281bc9a2f6ac212c59ad8.tar.xz |
libtf: minor changes and new test case for network i/o
fixup the internals a bit.
Diffstat (limited to 'include/libtf/fiber.h')
-rw-r--r-- | include/libtf/fiber.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/include/libtf/fiber.h b/include/libtf/fiber.h index 36c2812..c3d87c6 100644 --- a/include/libtf/fiber.h +++ b/include/libtf/fiber.h @@ -23,10 +23,10 @@ /* Fiber wakeup reasons */ #define TF_WAKEUP_NONE 0 -#define TF_WAKEUP_IMMEDIATE EAGAIN -#define TF_WAKEUP_KILL EINTR -#define TF_WAKEUP_TIMEOUT ETIMEDOUT -#define TF_WAKEUP_FD EIO +#define TF_WAKEUP_IMMEDIATE -EAGAIN +#define TF_WAKEUP_KILL -EINTR +#define TF_WAKEUP_TIMEOUT -ETIMEDOUT +#define TF_WAKEUP_FD -EIO /* Special timeouts for tf_schedule() */ #define TF_NO_TIMEOUT -1 @@ -50,6 +50,11 @@ struct tf_scheduler { }; +struct tf_main_ctx { + int argc; + char ** argv; +}; + static inline struct tf_scheduler *tf_get_scheduler(void) { @@ -71,7 +76,11 @@ tf_mtime_t tf_mtime(void) /* Fiber creation */ typedef void (*tf_fiber_proc)(void *fiber); -int tf_main(tf_fiber_proc fiber_main); +int tf_main_args(tf_fiber_proc fiber_main, int argc, char **argv); +static inline int tf_main(tf_fiber_proc fiber_main) +{ + return tf_main_args(fiber_main, 0, NULL); +} void *tf_fiber_create(tf_fiber_proc fiber_main, int private_size); void *tf_fiber_get(void *data); |