<div>Hello</div>
<div> </div>
<div> I think it's a logic problem, ChucK can't worry about everything. Other example, If you yiel two shereds in a particular way the time don't pass (I can't code it right now).<br> Maybe I'm wrong...</div>
<div> </div>
<div>Cheers</div>
<div>Lucas<br> </div>
<div><span class="gmail_quote">2008/11/9, eduard aylon <<a href="mailto:eduard.aylon@gmail.com">eduard.aylon@gmail.com</a>>:</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 "main". 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't want to advance time in any of them.<br>
<br>eduard<br><br>class mySpork<br>{<br> Event write;<br> Event read;<br><br> fun void start(){ read.signal(); <<<"started">>>; }<br><br> fun void Write()<br> {<br> // NOTE: time is not advanced in this function<br>
while(true)<br> {<br> write => now;<br> //<<< "writing" >>>;<br> read.signal();<br> }<br> }<br><br> fun void Read()<br> {<br> // NOTE: time is not advanced in this function<br>
while(true)<br> {<br> read => now;<br> //<<< "reading" >>>;<br> write.signal();<br> }<br> }<br>}<br><br>mySpork myspork;<br>spork~myspork.Read();<br>spork~myspork.Write();<br>
me.yield();<br>myspork.start();<br><<< "loops forever">>>;<br>1::second => now;<br><<< "and never gets here">>>;<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>