Libmill is a library that introduces Go-style concurrency to C

It can execute up to 20 million coroutines and 50 million context switches per second.

http://libmill.org/index.html

Go C
go foo(arg1, arg2, arg3) go(foo(arg1, arg2, arg3));
ch := make(chan int) chan ch = chmake(int, 0);
ch := make(chan int, 1000) chan ch = chmake(int, 1000);
ch <- 42 chs(ch, int, 42);
i := <- ch int i = chr(ch, int);
close(ch) chdone(ch, int, 0);
<garbage collector> chclose(ch);
select {
case ch <- 42:
foo()
case i := <- ch:
bar(i)
default:
baz()
}
choose {
out(ch, int, 42):
foo();
in(ch, int, i):
bar(i);
otherwise:
baz();
end
}
Advertisements