[chuck-users] Stopping and restart shreds

w31rd0 w31rd0 at mail.ru
Mon Jul 24 03:41:04 EDT 2006


> I'd like to use functions to stop and restart shreds. Is this the
> right way to do it? It doesn't seem to be working properly - I get
> errors from some shreds when I thought they'd all stopped.
> 
> Shred shredA, shredB;
> 
> fun void sporkAll() {
> 	spork ~ funA() @=> shredA;
> 	spork ~ funB() @=> shredB;
> 	me.yield();
> }
> 
> fun void killAllShreds() {
> 	shredA.exit();
> 	shredB.exit();
> 	me.yield();
> }

In previous versions of chuck invoking 'exit' on shred didn't seem to
work (for me). Instead I was killing shreds in this way:

shredA.id => machine.remove;

But in 1.2.0.6 'exit' seems to work properly.

Another significant note: the shred which is calling these functions
must not exit. Otherwise those functions won't work for some reason.

Developers, please correct me if I'm wrong :)

___________________
w31rd0




More information about the chuck-users mailing list