Hi Will,

Try use machine.remove(shred.id()) instead of shred.exit() :
See examples/shred/spork2.ck:

// define function
fun void foo()
{
    while( true )
    {
        <<< "hi" >>>;
        .2::second => now;
    }
}

// spork the function, remember the shred reference
spork ~ foo() @=> Shred @ s;

// wait for 2 seconds
2::second => now;

// remove by id
Machine.remove( s.id() );

// wait a little more
2::second => now;

Happy chucking!
Casper


On 1 nov. 2014, at 08:42, chuck-users-request@lists.cs.princeton.edu wrote:

Send chuck-users mailing list submissions to
chuck-users@lists.cs.princeton.edu

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
or, via email, send a message with subject or body 'help' to
chuck-users-request@lists.cs.princeton.edu

You can reach the person managing the list at
chuck-users-owner@lists.cs.princeton.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of chuck-users digest..."
Today's Topics:

  1. re  Instanceof in ChucK (Casper Schipper)
  2. Re: re  Instanceof in ChucK (Casper Schipper)
  3. Attempt to exit a sporked shred. (Will Hardwick-Smith)
  4. Un-chuck something? (Will Hardwick-Smith)

From: Casper Schipper <casper.schipper@gmail.com>
To: chuck-users@lists.cs.princeton.edu
Date: 31 oktober 2014 17:09:00 CET
Reply-To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
Subject: [chuck-users] re Instanceof in ChucK


Try .toString(): it's the closest thing.

SinOsc foo;
Object bar;

class MyClass {
    float value;
}

MyClass myInstance;

<<<foo.toString()>>>;
<<<bar.toString()>>>;
<<<myInstance.toString()>>>;


"SinOsc:10061d9a0" : (string)
"Object:61000009e190" : (string)
"MyClass:61000009e140" : (string)

Best,
Casper



  1. Instanceof in ChucK (Will Hardwick-Smith)

From: Will Hardwick-Smith <whardwicksmith@gmail.com>
Date: 30 oktober 2014 23:34:57 CET
Reply-To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
Subject: [chuck-users] Instanceof in ChucK


Say I have Object o, and I want to see if it is an instance of UGen or a sub-class of UGen.
Is there a way to check this in ChucK?


_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users




From: Casper Schipper <casper.schipper@gmail.com>
To: chuck-users@lists.cs.princeton.edu
Date: 31 oktober 2014 17:24:33 CET
Reply-To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
Subject: Re: [chuck-users] re Instanceof in ChucK


Ah sorry Will, I misread your question.

I am afraid that there is no built-in way in ChucK to check what is the super-class of an object. 

However, you could take a look at this earlier discussion which discusses the same problem:

best,
Casper

On 31 okt. 2014, at 17:09, Casper Schipper <casper.schipper@gmail.com> wrote:

Try .toString(): it's the closest thing.

SinOsc foo;
Object bar;

class MyClass {
    float value;
}

MyClass myInstance;

<<<foo.toString()>>>;
<<<bar.toString()>>>;
<<<myInstance.toString()>>>;


"SinOsc:10061d9a0" : (string)
"Object:61000009e190" : (string)
"MyClass:61000009e140" : (string)

Best,
Casper



  1. Instanceof in ChucK (Will Hardwick-Smith)

From: Will Hardwick-Smith <whardwicksmith@gmail.com>
Date: 30 oktober 2014 23:34:57 CET
Reply-To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
Subject: [chuck-users] Instanceof in ChucK


Say I have Object o, and I want to see if it is an instance of UGen or a sub-class of UGen.
Is there a way to check this in ChucK?


_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users





From: Will Hardwick-Smith <whardwicksmith@gmail.com>
To: chuck-users@lists.cs.princeton.edu
Date: 1 november 2014 06:47:05 CET
Reply-To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
Subject: [chuck-users] Attempt to exit a sporked shred.


I want to end/exit/destroy a sporked shred.

In this example code, I attempt to exit a sporked function. When executed, the shred doesn't stop as I'd expect.

fun void foo(){
    1::week => now;
}
spork ~ foo() @=> Shred shred;
2::second => now;
shred.exit();
1::week => now;

How can I exit the sporked shred? 



From: Will Hardwick-Smith <whardwicksmith@gmail.com>
To: chuck-users@lists.cs.princeton.edu
Date: 1 november 2014 08:42:15 CET
Reply-To: ChucK Users Mailing List <chuck-users@lists.cs.princeton.edu>
Subject: [chuck-users] Un-chuck something?


Is there a way to un-chuck something?
If this code is executed:
SinOsc sine => dac;
Is there a way to make it so sine is no longer being chucked to dac?


_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users