[chuck-users] quiting chuck from chuck and saving reference to function

Kassen signal.automatique at gmail.com
Wed Nov 8 08:05:12 EST 2006


Hi, list,

I'd like to come back to quitting ChucK from within ChucK for a second
because I was thinking about it before going to sleep.

If for a moment we asume we realy want to do it from withingChucK and so
ignore asking the OS and we don't like crashing then the only thing left is
killing all shreds by ID. This would be fine except that you can't get the
highest shred id.

I thought of a little trick that might be of some use or entertainment
value. What could be done is writing a seperate file that uppon entering the
VM would ask the VM for it's own shred ID (which would be the highest one at
that point), then kill every shred up to that number without advancing time.

It would be quite important to do this as a machine.add of a seperate file
and not as a sporked function because part of the problem is that if we
would kill the parent in that case that would also be the end of our
"killer". It would also be important to have the shred that would add this
file yield right after doing so to avoid other processes adding more files
in the meantime; anything that's not a child shred and has a id over the
killer shred's would survive.


Advantages; will kill everything in the VM without calls to the OS or
crashes, doesn't require all code to be prepared for this. Disadvantage;
will leave a empty VM in case it was told to "--loop".

Note from personal experience; if you make a way to kill the whole system in
a setup that also uses MIDI it's best to first end all MIDI notes....

Might be of use to someone, some time, so I thought I'd share.

Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20061108/d6387ea8/attachment.htm 


More information about the chuck-users mailing list