mirror of https://github.com/yandex/odyssey.git
40 lines
569 B
C
40 lines
569 B
C
![]() |
|
||
|
/*
|
||
|
* machinarium.
|
||
|
*
|
||
|
* Cooperative multitasking engine.
|
||
|
*/
|
||
|
|
||
|
#include <machinarium.h>
|
||
|
#include <machinarium_test.h>
|
||
|
|
||
|
static void
|
||
|
test_fiber(void *arg)
|
||
|
{
|
||
|
machine_channel_t channel;
|
||
|
channel = machine_channel_create();
|
||
|
|
||
|
machine_msg_t msg;
|
||
|
msg = machine_channel_read(channel, 100);
|
||
|
test(msg == NULL);
|
||
|
|
||
|
test(channel != NULL);
|
||
|
machine_channel_free(channel);
|
||
|
}
|
||
|
|
||
|
void
|
||
|
test_channel_timeout(void)
|
||
|
{
|
||
|
machinarium_init();
|
||
|
|
||
|
int id;
|
||
|
id = machine_create("test", test_fiber, NULL);
|
||
|
test(id != -1);
|
||
|
|
||
|
int rc;
|
||
|
rc = machine_wait(id);
|
||
|
test(rc != -1);
|
||
|
|
||
|
machinarium_free();
|
||
|
}
|