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://codercto.com/soft/d/4.html

Alone Together

Alone Together

Sherry Turkle / Basic Books / 2011-1-11 / USD 28.95

Consider Facebookit’s human contact, only easier to engage with and easier to avoid. Developing technology promises closeness. Sometimes it delivers, but much of our modern life leaves us less connect......一起来看看 《Alone Together》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

SHA 加密
SHA 加密

SHA 加密工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具