Re: [chuck-users] implementing a "wait for signal with timeout"
Attached is a solution I came up with for this problem that I used in my PLOrk piece this spring. I spork a "possibility" for something to happen, which waits on an event. Immediately after I spork a "timeout" shred that kills the possibility shred if the event doesn't come in time. One downside of this (I'm sure there are others I haven't thought of!) is that using Machine.remove causes stuff to print in the console. To get rid of that I piped the output to grep. From the command line run: chuck timeout.ck 2>&1 | grep -v removing Cameron
On 9 Jun 2009, at 16:57, N. Cameron Britt wrote:
Attached is a solution I came up with for this problem that I used in my PLOrk piece this spring. I spork a "possibility" for something to happen, which waits on an event. Immediately after I spork a "timeout" shred that kills the possibility shred if the event doesn't come in time.
One downside of this (I'm sure there are others I haven't thought of!) is that using Machine.remove causes stuff to print in the console. To get rid of that I piped the output to grep. From the command line run: chuck timeout.ck 2>&1 | grep -v removing
You can also send it to /dev/null. But 'chuck' printing causes time delays - and I think it is internal. Hans
participants (2)
-
Hans Aberg
-
N. Cameron Britt