libcsp是一个C语言实现的基于CSP模型的高性能并发库, 利用它你可以用C开发一些高性能项目.
// Golang // Libcsp go foo(arg1, arg2, arg3) async(foo(arg1, arg2, arg3)); var wg sync.WaitGroup sync(foo(); bar()); wg.Add(2) go func() { defer wg.Done(); foo(); }() go func() { defer wg.Done(); bar(); }() wg.Wait() runtime.Gosched() yield(); chn := make(chan int, 1 << 6) chan_t(int) *chn = chan_new(int)(6); num = <-chn chan_pop(chn, &num); chn <- num chan_push(chn, num); timer := time.AfterFunc(time.Second, foo) timer_t timer = timer_after(timer_second, foo()); timer.Stop() timer_cancel(timer);
Github: https://github.com/shiyanhui/libcsp
文档: https://libcsp.com