[chuck-users] Detecting when child shred has finished

Kassen signal.automatique at gmail.com
Fri Sep 19 18:04:53 EDT 2008


Paul Reiners;

Is it possible to determine when a child shred has finished executing
> if you have a reference to the child shred?


I'd say so, let me quote from the "VERSIONS" file from the latest release;

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

I'm not 100% sure what "running" is supposed to refer to (perhaps I
misunderstand it?) but  "done" seems to suit your needs;

================== 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<======================

Please note that calling these on a Shred object with no shred process
attached to it will return more or less random numbers which is probably a
bug.

Yours,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080920/0a73b42b/attachment.htm>


More information about the chuck-users mailing list