[chuck-users] Stopping and restart shreds
Ge Wang
gewang at CS.Princeton.EDU
Tue Jul 25 17:38:58 EDT 2006
> On 7/24/06, w31rd0 <w31rd0 at mail.ru> wrote:
>> Another significant note: the shred which is calling these functions
>> must not exit. Otherwise those functions won't work for some reason.
>>
>> Developers, please correct me if I'm wrong :)
>
> I think that might be related to a bug I ran into a while back. I'd
> have a shred report that it was going to exit (using <<<....>>> ),
> then exit. This would result in a shred that would be gone but no
> comment on the schreen. Having some small amount of time pass
> inbetween would fix this.
>
> Could be the same issue; I'm not at home or near a chuck-ing computer
> but try a simple 1::ms => now; inbetween those lines and see wether it
> works. Ugly but maybe a work-around for now?
Currently in ChucK, a parent shred will terminate any child shreds when
the parent terminates. For example:
---
// start
fun void foo()
{
<<< "foo!!!" >>>;
}
// spork foo
spork ~ foo();
// end of program
---
In this case, "foo" will NOT print because the parent shred has exited
before the child has a chance to run. As Kassen mentioned, advancing
time in the parent shred will allow children to execute. If no time
advance is desired, me.yield() should work.
---
// start
fun void foo()
{
<<< "foo!!!" >>>;
}
// spork foo
spork ~ foo();
// yield to let foo run, no time advance
me.yield();
// end of program
---
Hope this helps.
Ge!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1500 bytes
Desc: not available
Url : http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20060725/f00626be/attachment.bin
More information about the chuck-users
mailing list