I couldn't find this in a search, but I'm not exactly sure what it's called. I'd like to be able to unspork (despork?) a shred sometime after i've sporked it, based on OSC input. is there a convenient way to do this? thanks -k
Doesn't this effectively happen if the method executing in the shred exits?
LIke this:
1 => int running;
fun void daShred() {
while (running) {
1::ms => now;
}
}
unsporkIt() {
0 => running;
}
spork ~ daShred();
I remember that for Java threads (which admittedly isn't exactly the same as
shreds), this is a recommended practice.
/Stefan
On Mon, Mar 17, 2008 at 9:19 AM, kevin
I couldn't find this in a search, but I'm not exactly sure what it's called.
I'd like to be able to unspork (despork?) a shred sometime after i've sporked it, based on OSC input.
is there a convenient way to do this?
thanks -k
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Release me, insect, or I will destroy the Cosmos!
On 17/03/2008, Stefan Blixt
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.
@stefan, thanks for the hackery method =)
@kas, i thought i tried that, but i might have gotten confused at the "spork
~ my_fun() @=> my_shred;" line
the online documentation says "spork ~ my_fun() => Shred @ my_shred;"
without declaring my_shred first, and this gives syntax errors.
I was trying to do the my_shred.exit(); thing, but was getting syntax
errors. i didn't save what i was working on, so i can't post it, but i'll
try it this way when i get a chance.
thanks
-k
On Mon, Mar 17, 2008 at 4:02 AM, Kassen
On 17/03/2008, Stefan Blixt
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.
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (3)
-
Kassen
-
kevin
-
Stefan Blixt