Hey I prefer Tom&#39;s version! I shouldn&#39;t be racy if I read the resumeProcess and resume code correctly. The resumeProcess message has no effect on non-waiting processes!<br><br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | waitingProcess wakeupProcess |
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; waitingProcess _ Processor activeProcess.<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wakeupProcess _<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [(Delay forMilliseconds: (anInteger max: 0)) wait.<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self resumeProcess: waitingProcess] fork.
<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self wait.<br>&nbsp;&nbsp;&nbsp; &quot;preempting here and getting the resumeProcess message sent would have no effect - therefore no race!&quot;<br>&nbsp;&nbsp;&nbsp; &quot;in comparison having a semaphore getting signaled here would cause an excess signal on the sem: bad&quot;
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wakeupProcess terminate.<br><br>Cheers!<br>Georg<br><br><div class="gmail_quote">On Jan 5, 2008 9:43 AM, Andreas Raab &lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</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;">
<div class="Ih2E3d">Tom Phoenix wrote:<br>&gt; Is that the source in your image for that method? Here&#39;s what I have:<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp; waitTimeoutMSecs: anInteger<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Wait on this semaphore for up to the given number of milliseconds,
<br>&gt; then timeout. It is up to the sender to determine the difference<br>&gt; between the expected event and a timeout.&quot;<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | waitingProcess wakeupProcess |<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; waitingProcess _ Processor activeProcess.
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wakeupProcess _<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [(Delay forMilliseconds: (anInteger max: 0)) wait.<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self resumeProcess: waitingProcess] fork.<br>&gt;<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self wait.
<br>&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wakeupProcess terminate.<br><br></div>How odd. It seems that this version is only present in 3.9 - all other<br>images have a variant of the (much simpler) code:<br><div class="Ih2E3d"><br>waitTimeoutMSecs: anInteger
<br> &nbsp; &nbsp; &quot;Wait on this semaphore for up to the given number of milliseconds,<br>then timeout. It is up to the sender to determine the difference between<br>the expected event and a timeout.&quot;<br></div><div class="Ih2E3d">
 &nbsp; &nbsp; | d |<br> &nbsp; &nbsp; d := Delay timeoutSemaphore: self afterMSecs: (anInteger max: 0).<br></div> &nbsp; &nbsp; [self wait] ensure:[d unschedule].<br><br>The 3.9 version is tagged &quot;jf 12/2/2003&quot; but there is no indication what
<br>it is trying to address (if anything).<br><br>Cheers,<br><font color="#888888"> &nbsp; &nbsp;- Andreas<br><br></font></blockquote></div><br>