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 /src/fiber.c | |
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 'src/fiber.c')
-rw-r--r-- | src/fiber.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/fiber.c b/src/fiber.c index aa83fa8..b678842 100644 --- a/src/fiber.c +++ b/src/fiber.c @@ -123,20 +123,27 @@ static void process_runq(struct tf_scheduler *sched) } } -int tf_main(tf_fiber_proc main_fiber) +int tf_main_args(tf_fiber_proc main_fiber, int argc, char **argv) { struct tf_uctx *ctx = alloca(sizeof(struct tf_uctx) + sizeof(struct tf_scheduler)); struct tf_scheduler *sched = (struct tf_scheduler*) ctx->fiber.data; + struct tf_main_ctx *mainctx; int stack_guard = STACK_GUARD; ctx->stack_guard = &stack_guard; *sched = (struct tf_scheduler){ .run_q = TF_LIST_HEAD_INITIALIZER(sched->run_q), }; + __tf_scheduler = sched; tf_poll_init(); update_time(sched); - tf_fiber_put(tf_fiber_create(main_fiber, 0)); + + mainctx = tf_fiber_create(main_fiber, sizeof(struct tf_main_ctx)); + mainctx->argc = argc; + mainctx->argv = argv; + tf_fiber_put(mainctx); + do { tf_mtime_diff_t timeout; |