summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/sleep.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/sleep.c b/test/sleep.c
new file mode 100644
index 0000000..7e39b5c
--- /dev/null
+++ b/test/sleep.c
@@ -0,0 +1,31 @@
+#include <libtf/tf.h>
+#include <stdio.h>
+
+struct ctx {
+ int timeout;
+};
+
+static void work_fiber(void *ptr)
+{
+ //struct ctx *c = (struct ctx*) ptr;
+
+ tf_msleep(rand() % 5000);
+ tf_msleep(rand() % 5000);
+ tf_msleep(rand() % 5000);
+}
+
+static void init_fiber(void *ptr)
+{
+ struct ctx *c;
+ int i;
+
+ for (i = 0; i < 1000; i++) {
+ c = tf_fiber_create(work_fiber, sizeof(struct ctx));
+ tf_fiber_put(c);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ return tf_main(init_fiber);
+}