如果您有对子shred的引用,是否可以确定ChucK子shred何时完成执行?例如,在此代码中:
// define function go()
fun void go()
{
// insert code
}
// spork another, store reference to new shred in offspring
spork ~ go() => Shred @ offspring;是否可以确定offspring何时完成执行?
发布于 2008-09-19 23:03:03
我会这么说,让我引用最新版本中的“版本”文件;
- (added) int Shred.done() // is the shred done?
int Shred.running() // is the shred running? 我不是百分之百确定“跑步”应该指的是什么(也许我误解了它?)但是“完成”似乎满足了你的需要;
================== 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<======================
请注意,在没有附加Shred进程的shred对象上调用这些函数会返回或多或少的随机数,这可能是一个bug。
-卡森在chuck-users mailing list上的回答。
https://stackoverflow.com/questions/105771
复制相似问题