<HTML><HEAD>
<STYLE><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></STYLE>

<META http-equiv=Content-Type content="text/html; charset=iso-8859-15">
<META content="MSHTML 6.00.6002.18130" name=GENERATOR></HEAD>
<BODY class=hmmessage>
<DIV>Jay:  I never messed around much with the 3.6 code.  I purchased the 4.1 commercial version.  Prior to that we did use the DEC SRC version and that would have been the extent of my 3.6 familiarity.  After the commercial release came out, we went exclusively with Critical Mass 4.1.</DIV>
<DIV>Regards,</DIV>
<DIV>Randy<BR><BR>>>> Jay K <jay.krell@cornell.edu> 12/12/2009 11:56 PM >>><BR>Randy, Thanks. I fixed Win32 to be like that. pthreads still looks wrong.<BR> <BR> <BR>Note that the 3.6 code doesn't seem to get it right:<BR> <BR> <BR>PROCEDURE AlertPause(n: LONGREAL) RAISES {Alerted} =<BR>  VAR amount, thisTime: LONGREAL;<BR>  CONST Limit = FLOAT(LAST(CARDINAL), LONGREAL) / 1000.0D0 - 1.0D0;<BR>  VAR self: T;<BR>  BEGIN<BR>    self := Self();<BR>    amount := n;<BR>    WHILE amount > 0.0D0 DO<BR>      thisTime := MIN (Limit, amount);<BR>      amount := amount - thisTime;<BR>      WinBase.EnterCriticalSection(cm);<BR>      InnerTestAlert(self);<BR>      self.alertable := TRUE;<BR>      <* ASSERT(self.waitingOn = NIL) *><BR>      WinBase.LeaveCriticalSection(cm);<BR>      EVAL WinBase.WaitForSingleObject(self.waitSema, ROUND(thisTime*1.0D3));<BR>      WinBase.EnterCriticalSection(cm);<BR>      self.alertable := FALSE;<BR>      IF self.alerted THEN<BR>        (* Sadly, the alert might have happened after we timed out on the<BR>           semaphore and before we entered "cm". In that case, we need to<BR>           decrement the semaphore's count *)<BR>        EVAL WinBase.WaitForSingleObject(self.waitSema, 0);<BR>        InnerTestAlert(self);<BR>      END;<BR>      WinBase.LeaveCriticalSection(cm);<BR>    END;<BR>  END AlertPause;<BR><BR>The 3.6 and current user threads code seems ok, but I've not very familiar with it.<BR> <BR>This might be one of those things though that's been consistently broken for so long that it's best not to depend on?<BR>Prefer AlertPause(0.01) over AlertPause(0)??<BR> <BR> <BR> - Jay<BR><BR><BR> <BR></DIV>
<DIV>
<HR id=stopSpelling>
</DIV>
<DIV>Date: Sat, 12 Dec 2009 23:56:08 -0500<BR>From: rcoleburn@scires.com<BR>To: m3devel@elegosoft.com<BR>Subject: Re: [M3devel] AlertPause(0) is alertable?<BR><BR></DIV>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>

<DIV>My understanding of the interface has always been as you suggest, namely, yes you should get an "Alerted" exception if the thread is marked alerted regardless of the value of the n (seconds) parameter.</DIV>
<DIV> </DIV>
<DIV>Regards,</DIV>
<DIV>Randy<BR><BR>>>> Jay K <jay.krell@cornell.edu> 12/12/2009 7:37 PM >>><BR>If I call AlertPause with <= 0 time, should I recieve alerts?<BR>Current pthread/win32 implementations: no.<BR> They say if time <= then return end before doing much.<BR>My suspicion: yes.<BR><BR><BR>Thread.i3:<BR> <BR>PROCEDURE AlertPause(n: LONGREAL) RAISES {Alerted};<BR>(* Like "Pause", but if the thread is marked alerted at the time of<BR>   the call or sometime during the wait, raise "Alerted". *)<BR><BR> <BR> - Jay<BR></DIV></BODY></HTML>