summaryrefslogtreecommitdiffstats
path: root/test/sleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/sleep.c')
-rw-r--r--test/sleep.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/sleep.c b/test/sleep.c
index 7e39b5c..82399e1 100644
--- a/test/sleep.c
+++ b/test/sleep.c
@@ -8,24 +8,23 @@ struct ctx {
static void work_fiber(void *ptr)
{
//struct ctx *c = (struct ctx*) ptr;
-
tf_msleep(rand() % 5000);
+ printf("one\n");
tf_msleep(rand() % 5000);
+ printf("two\n");
tf_msleep(rand() % 5000);
+ printf("three\n");
}
-static void init_fiber(void *ptr)
+int main(int argc, char **argv)
{
struct ctx *c;
int i;
- for (i = 0; i < 1000; i++) {
- c = tf_fiber_create(work_fiber, sizeof(struct ctx));
+ tf_scheduler_enable(NULL);
+ for (i = 0; i < 100; i++) {
+ c = tf_fiber_create(NULL, work_fiber, sizeof(struct ctx));
tf_fiber_put(c);
}
-}
-
-int main(int argc, char **argv)
-{
- return tf_main(init_fiber);
+ tf_scheduler_disable();
}