#include #include struct ctx { int timeout; }; 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"); } int main(int argc, char **argv) { struct ctx *c; int i; tf_vmach_start(); for (i = 0; i < 1000; i++) { c = tf_fiber_create(work_fiber, sizeof(struct ctx)); tf_fiber_run(c); } tf_vmach_stop(); }