libdill

C library for structured concurrency and lightweight coroutines

brewmacoslinux
Try with needOr install directly
Source

About

Structured concurrency in C

Commands

libdill

Examples

Include libdill headers in C program for coroutine support$ gcc -o program program.c -ldill
Create a simple coroutine that yields execution$ cat > coro.c << 'EOF' #include <libdill.h> #include <stdio.h> int main() { int ch = chmake(int); go({ chsend(ch, 42); }); int val; chrecv(ch, &val); printf("%d\n", val); return 0; } EOF gcc -o coro coro.c -ldill && ./coro
Use libdill for managing multiple concurrent operations$ gcc -Wall -o concurrent program.c -ldill && ./concurrent