diff options
author | Timo Teras <timo.teras@iki.fi> | 2010-03-10 13:58:39 +0200 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2010-03-10 13:58:39 +0200 |
commit | 5ef38570315dc68d7ddf8d9475d9a8830528e8a4 (patch) | |
tree | f88fc542b5231614ac6c22a75baea90d82449d6c /test/simple1.c | |
parent | 43e69b26126b8708b70680c6b4806eb3844386ab (diff) | |
download | libtf-5ef38570315dc68d7ddf8d9475d9a8830528e8a4.tar.bz2 libtf-5ef38570315dc68d7ddf8d9475d9a8830528e8a4.tar.xz |
libtf: separate scheduler fibre, change the core api
Diffstat (limited to 'test/simple1.c')
-rw-r--r-- | test/simple1.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/test/simple1.c b/test/simple1.c index 65a787c..6a05b7a 100644 --- a/test/simple1.c +++ b/test/simple1.c @@ -10,23 +10,20 @@ static void work_fiber(void *ptr) struct ctx *c = (struct ctx*) ptr; printf("Hello%d.1\n", c->id); - tf_yield(); + tf_fiber_yield(); printf("Hello%d.2\n", c->id); } -static void init_fiber(void *ptr) +int main(int argc, char **argv) { struct ctx *c; int i; + tf_scheduler_enable(NULL); for (i = 0; i < 6; i++) { - c = tf_fiber_create(work_fiber, sizeof(struct ctx)); + c = tf_fiber_create(NULL, work_fiber, sizeof(struct ctx)); c->id = i; tf_fiber_put(c); } -} - -int main(int argc, char **argv) -{ - return tf_main(init_fiber); + tf_scheduler_disable(); } |