2015-03-21 11:47:51 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "coio.h"
|
|
|
|
|
2015-03-25 20:16:49 +00:00
|
|
|
void
|
|
|
|
_t1(void *arg)
|
2015-03-21 11:47:51 +00:00
|
|
|
{
|
|
|
|
printf("Hello 1 from _t1\n");
|
|
|
|
coio_yield();
|
|
|
|
printf("Hello 2 from _t1\n");
|
|
|
|
}
|
|
|
|
|
2015-03-25 20:16:49 +00:00
|
|
|
void
|
|
|
|
_t2(void *arg)
|
2015-03-21 11:47:51 +00:00
|
|
|
{
|
|
|
|
printf("Hello 1 from _t2\n");
|
|
|
|
coio_yield();
|
|
|
|
printf("Hello 2 from _t2\n");
|
|
|
|
}
|
|
|
|
|
2015-03-25 20:16:49 +00:00
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
2015-03-21 11:47:51 +00:00
|
|
|
{
|
2015-03-25 20:16:49 +00:00
|
|
|
(void) argc;
|
|
|
|
(void) argv;
|
2015-03-21 11:47:51 +00:00
|
|
|
|
|
|
|
coio_create(_t1, NULL, 0x8000);
|
|
|
|
coio_create(_t2, NULL, 0x8000);
|
|
|
|
|
2015-03-25 20:16:49 +00:00
|
|
|
if (coio_main() < 0) {
|
2015-03-21 11:47:51 +00:00
|
|
|
printf("Deadlocked\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|