mirror of https://github.com/yandex/odyssey.git
33 lines
393 B
C
33 lines
393 B
C
|
|
/*
|
|
* machinarium.
|
|
*
|
|
* Cooperative multitasking engine.
|
|
*/
|
|
|
|
#include <machinarium.h>
|
|
#include <machinarium_test.h>
|
|
|
|
static void
|
|
coroutine(void *arg)
|
|
{
|
|
machine_sleep(0);
|
|
machine_stop();
|
|
}
|
|
|
|
void
|
|
test_sleep_yield(void)
|
|
{
|
|
machinarium_init();
|
|
|
|
int id;
|
|
id = machine_create("test", coroutine, NULL);
|
|
test(id != -1);
|
|
|
|
int rc;
|
|
rc = machine_wait(id);
|
|
test(rc != -1);
|
|
|
|
machinarium_free();
|
|
}
|