C 语言并发编程库 Libdill

码农软件 · 软件分类 · 网络工具包 · 2019-02-23 01:02:37

软件介绍

Libdill 是一个 C 开发库,可以轻松用来编写结构化的并发程序。下面例子启动两个并发的 worker 函数打印 Hello 和 World :

#include <libdill.h>
#include <stdio.h>
#include <stdlib.h>

coroutine void worker(const char *text) {
    while(1) {
        printf("%s\n", text);
        msleep(now() + random() % 500);
    }
}

int main() {
    go(worker("Hello!"));
    go(worker("World!"));
    msleep(now() + 5000);
    return 0;
}

编译方法:

$ cc -ldill -o hello hello.c

本文地址:https://www.codercto.com/soft/d/4.html

The Lean Startup

The Lean Startup

Eric Ries / Crown Business / 2011-9-13 / USD 26.00

更多中文介绍:http://huing.com Most startups fail. But many of those failures are preventable. The Lean Startup is a new approach being adopted across the globe, chan ging the way companies are built and ......一起来看看 《The Lean Startup》 这本书的介绍吧!

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具