[chuck-users] unsporking

Kassen signal.automatique at gmail.com
Mon Mar 17 07:02:14 EDT 2008


On 17/03/2008, Stefan Blixt <stefan.blixt at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080317/d6b8f0ac/attachment.htm 


More information about the chuck-users mailing list