【问题标题】:Detecting when ChucK child shred has finished检测 ChuckK 子碎片何时完成
【发布时间】:2008-09-20 07:03:03
【问题描述】:

如果您有对子碎片的引用,是否可以确定 ChuckK 子碎片何时完成执行?例如,在这段代码中:

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

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

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

【问题讨论】:

    标签: chuck


    【解决方案1】:

    我会这么说,让我引用最新版本的“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

    请注意,在没有附加粉碎进程的 Shred 对象上调用这些将返回或多或少的随机数,这可能是一个错误。

    ---来自卡森chuck-users mailing list的回答。

    【讨论】:

      猜你喜欢
      • 2019-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-14
      • 1970-01-01
      • 1970-01-01
      • 2012-06-30
      • 1970-01-01
      相关资源
      最近更新 更多