[chuck-users] quiting chuck from chuck and saving reference to function
altern
altern2 at gmail.com
Thu Nov 9 22:30:05 EST 2006
:( but it bloks the main loop ...
altern wrote:
> I just needed this, setting variable off to 1 exits the main loop. I am
> still confused with ChucK ;) so i guess i did not asked the question in
> the right way.
>
> 0=>int off;
> while(true){
> if(off){break;}
> 0.2::second => now;
> }
>
>
> Kassen wrote:
>> 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.
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
More information about the chuck-users
mailing list