如果您提到儿童碎片,是否可以确定ChucK儿童碎片何时完成执行?例如,在此代码中:

// define function go()
fun void go()
{
    // insert code
}

// spork another, store reference to new shred in offspring
spork ~ go() => Shred @ offspring;

是否可以确定 offspring 何时完成执行?

有帮助吗?

解决方案

我会这样说,让我引用“VERSIONS”一词。来自最新版本的文件;

  - (added) int Shred.done()  // is the shred done?
            int Shred.running()  // is the shred running? 

我不是100%肯定什么是“正在运行”应该是指(也许我误解了它?)但是“完成”了似乎适合你的需要;

================== 8< ================

fun void foo()
    {
    second => now;
    }

spork ~ foo() @=> Shred bar;

<<<bar.done()>>>;
<<<bar.running()>>>; // why is this 0? Bug?
2::second => now;
<<<bar.done()>>>;
<<<bar.running()>>>;

========== 8&LT; ======================

请注意,在没有连接Shred进程的Shred对象上调用它们将返回或多或少的随机数,这可能是一个错误。

--- Kassen对 chuck-users邮件列表的回答

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top