<div>Hello</div>
<div>&nbsp;</div>
<div>&nbsp;&nbsp;&nbsp; I think it&#39;s a logic problem, ChucK can&#39;t worry about everything. Other example,&nbsp;If you yiel two shereds in a particular way the time don&#39;t pass (I can&#39;t code it&nbsp;right now).<br>&nbsp;&nbsp;&nbsp; Maybe I&#39;m wrong...</div>

<div>&nbsp;</div>
<div>Cheers</div>
<div>Lucas<br>&nbsp;</div>
<div><span class="gmail_quote">2008/11/9, eduard aylon &lt;<a href="mailto:eduard.aylon@gmail.com">eduard.aylon@gmail.com</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Sorry list for bombing you with so many questions, but got this funny one, which I thought would be interesting to post. The patch below loops endlessly although no while(true) loop exists in the &quot;main&quot;. If you try the patch, be warn that your computer may (or may not) become unresponsive. The code makes sense, and the behaviour as well, but should chuck throw a warning when something like this happens? I came up with this, while trying to have a process for reading and another for writing, but didn&#39;t want to advance time in any of them.<br>
<br>eduard<br><br>class mySpork<br>{<br>&nbsp;Event write;<br>&nbsp;Event read;<br><br>&nbsp;fun void start(){ read.signal(); &lt;&lt;&lt;&quot;started&quot;&gt;&gt;&gt;; }<br><br>&nbsp;fun void Write()<br>&nbsp;{<br>&nbsp; &nbsp;// NOTE: time is not advanced in this function<br>
&nbsp; &nbsp;while(true)<br>&nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp;write =&gt; now;<br>&nbsp; &nbsp; &nbsp;//&lt;&lt;&lt; &quot;writing&quot; &gt;&gt;&gt;;<br>&nbsp; &nbsp; &nbsp;read.signal();<br>&nbsp; &nbsp;}<br>&nbsp;}<br><br>&nbsp;fun void Read()<br>&nbsp;{<br>&nbsp; &nbsp;// NOTE: time is not advanced in this function<br>
&nbsp; &nbsp;while(true)<br>&nbsp; &nbsp;{<br>&nbsp; &nbsp; &nbsp;read =&gt; now;<br>&nbsp; &nbsp; &nbsp;//&lt;&lt;&lt; &quot;reading&quot; &gt;&gt;&gt;;<br>&nbsp; &nbsp; &nbsp;write.signal();<br>&nbsp; &nbsp;}<br>&nbsp;}<br>}<br><br>mySpork myspork;<br>spork~myspork.Read();<br>spork~myspork.Write();<br>
me.yield();<br>myspork.start();<br>&lt;&lt;&lt; &quot;loops forever&quot;&gt;&gt;&gt;;<br>1::second =&gt; now;<br>&lt;&lt;&lt; &quot;and never gets here&quot;&gt;&gt;&gt;;<br><br>_______________________________________________<br>
chuck-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div><br>