odyssey/tests/test_sleep.c

32 lines
523 B
C
Raw Normal View History

2016-11-24 13:53:36 +00:00
/*
* machinarium.
*
* Cooperative multitasking engine.
*/
#include <machinarium.h>
#include <assert.h>
static void
test_child(void *arg)
{
machine_t machine = arg;
2016-11-24 13:53:36 +00:00
printf("child started\n");
printf("sleep 10 ms\n");
machine_sleep(machine, 10);
2016-11-24 13:53:36 +00:00
printf("sleep wakeup\n");
printf("child ended\n");
machine_stop(machine);
2016-11-24 13:53:36 +00:00
}
int
main(int argc, char *argv[])
{
machine_t machine = machine_create();
machine_create_fiber(machine, test_child, machine);
machine_start(machine);
machine_free(machine);
2016-11-24 13:53:36 +00:00
return 0;
}