检测ChucK儿童切碎的完成时间
时间:2020-03-06 14:27:56 来源:igfitidea点击:
如果我们有对ChucK子碎片的引用,是否可以确定ChucK子碎片的完成时间?例如,在此代码中:
// define function go() fun void go() { // insert code } // spork another, store reference to new shred in offspring spork ~ go() => Shred @ 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 <======================
请注意,在未连接任何切碎进程的切碎对象上调用这些对象将返回或者多或者少的随机数,这可能是一个错误。
---来自卡森(Kassen)的查克用户邮件列表上的答案。