Hi, list,<br><br>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.<br><br>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.
<br><br>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.
<br><br>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 &quot;killer&quot;. 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.
<br><br><br>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 &quot;--loop&quot;.<br>
<br>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....<br><br>Might be of use to someone, some time, so I thought I'd share.<br>
<br>Kas.<br>