d语言线程操作示例代码

代码语言:d

所属分类:其他

代码描述:d语言线程操作示例代码

代码标签: 操作 示例 线程

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

import std.stdio;
import std.concurrency;
import core.thread;
 
void workerFunc() {
    Thread.sleep(3.seconds);
    ownerTid.send("hello");
}
 
void main() {
    spawn(&workerFunc);
 
    writeln("Waiting for a message");
    bool received = false;
    while (!received) {
        received = receiveTimeout(600..........完整代码请登录后点击上方下载按钮下载查看

网友评论0