Actually, come to think of it, Mike, why have the Bang object at all? Why not just move the code (the if statements) from the main loop into the oscListener loops/shreds, and replace the broadcast with actual functionality instead? Maybe there is some more advanced stuff that you haven&#39;t included that prevents this?<br>
<br>/Stefan<br><br><div class="gmail_quote">On Mon, Apr 28, 2008 at 6:00 PM, Stefan Blixt &lt;<a href="mailto:stefan.blixt@gmail.com">stefan.blixt@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Yeah, but note that there are two shreds running this loop in parallell. So if one event on each port arrive at the same time, chances are that the first yield will hand over execution to the second shred, that in turn overwrites b.value and b.message. I think you need at least two Bang instances to be sure that this doesn&#39;t happen.<br>
<font color="#888888">
<br>/Stefan<br><br></font><div class="gmail_quote"><div><div></div><div class="Wj3C7c">On Mon, Apr 28, 2008 at 5:10 PM, Kassen &lt;<a href="mailto:signal.automatique@gmail.com" target="_blank">signal.automatique@gmail.com</a>&gt; wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">
2008/4/28 Stefan Blixt &lt;<a href="mailto:stefan.blixt@gmail.com" target="_blank">stefan.blixt@gmail.com</a>&gt;:<div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


I don&#39;t know about the segv signal, but it seems to me that there is only one Bang instance that is shared by all iterations/shreds. This means that if two events arrive at this loop:<div><br><br>&nbsp; &nbsp; &nbsp;&nbsp; while( oe.nextMsg() ) {<br>




 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oe.getInt() =&gt; b.value;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;osctype =&gt; b.message;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;b.broadcast();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br><br></div>the second&#39;s values will overwrite those of the first (value and message from the first event will be lost).</blockquote></div><br></div>I think that&#39;s right and I think the way around this would be<div>

<br>
<br>&nbsp; &nbsp; &nbsp;&nbsp; while( oe.nextMsg() ) {<br>

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oe.getInt() =&gt; b.value;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;osctype =&gt; b.message;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;b.broadcast();<br></div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //yield to receiving shreds,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //then continue processing the message cue<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; me.yield();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br><br>This is the exact same principle I talked about earlier in this topic; if you don&#39;t yield you don&#39;t give the waiting shreds a chance to run. Advancing time here would probably not be a good idea.<br>


<br>Yours,<br>Kas.<br>
<br></div></div><div class="Ih2E3d">_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></div></blockquote></div><div><div></div><div class="Wj3C7c"><br><br clear="all"><br>-- <br>Release me, insect, or I will destroy the Cosmos!
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Release me, insect, or I will destroy the Cosmos!