[chuck-users] Returning a Shred and crashing Chuck

Kassen signal.automatique at gmail.com
Fri Jun 13 07:40:41 EDT 2008


> What gives?  It apparently doesn't like the return of the Shred
> object.  I'm not sure what's happening here.  It's not *really* that
> important to me, but it would be nice to have the option of killing
> that process later.
> Any ideas?  Am I doing something wrong???

Weird. Adding a single line like this;

class Forkable {
   // I am a process
   fun void run() {
       // sporkable code here...
       SinOsc s => dac;
       100::ms => now;

       s =< dac;

Makes the first example behave as well. The difference seems to be that the
SinOsc's aren't automatically unchucked from the dac when the their shred
exits in the first example.... and this seems due to the existance of that
reference. This leads to clipping and a high cpu load, resulting in that
weird noise because you are still creating 20 SinOsc's per second.

My bet would be that this might be a case of reference counting gone wrong.
At least it's fixable with a manual unchuck though it's quite odd that
SinOsc's that aren't attached to a Shred can keep running. In fact; with my
edit of the Forkable class I can start your code, stop it, and often a tone
will keep sounding without a single shred running (!!!).

Strange stuff, good catch!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080613/c8701163/attachment.html>

More information about the chuck-users mailing list