On 17/03/2008, Stefan Blixt <stefan.blixt@gmail.com> wrote:
Doesn't this effectively happen if the method executing in the shred exits? LIke this:
Yes, it does, and that's one way. Another is to use the "Machine" device. For example "Machine.remove(15);" will remove the shred with id 15 (see chuck --status for id numbers). Note that that spork operations will return the id of the new shred as a int.
Also possible;
--------------------------------------------------
//create a shred reference with a name
Shred my_shred;
//assign a bit of running code to it
spork ~ my_fun() @=> my_shred;
//other stuff happens
5::minute => now;
//this is really quite readable compared to other options.
my_shred.exit();
-----------------------------------------
Hope that helps,
Kas.