Skip to content

Latest commit

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Build & Usage

Requirements

  • liburing

Build shared and static library using make. Build artifacts can be found in build/.

Basic Coroutine Example

#include<stdio.h>#include<tandem/coro.h>#defineSTACK_SIZE 64 * 1024
voidfoo(td_rt*rt) {
for (inti=1; i <= 10; i++) {
printf("FOO: %d\n", i);
td_suspend(rt);
}
}
voidbar(td_rt*rt) {
for (inti=2; i <= 10; i+=2) {
printf("BAR: %d\n", i);
td_suspend(rt);
}
}
intmain() {
td_rt*rt=td_init();
td_coro*coro1=td_spawn(rt, &foo, 0, NULL, STACK_SIZE);
td_coro*coro2=td_spawn(rt, &bar, 0, NULL, STACK_SIZE);
while (coro1->status==TD_CORO_RUNNING||coro2->status==TD_CORO_RUNNING) {
printf("MAIN\n");
td_resume(rt, coro1);
td_resume(rt, coro2);
}
td_free(rt);
return0;
}

About

A simple asyncronous concurrency library in c

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages