<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
[was truncated..]<BR>
Oh -- it is so you can wait for more than 4 billion<BR>
milliseconds, I guess.<BR>The chunk size of the loop is roughly the maximum<BR>
time WaitForSingleObject is allowed.<BR>Ok.<BR><BR>
 <BR>
btw, we could also use Win32's native "alert"<BR>
mechanism. That would save creating all the alert events.<BR>
The downside is that I don't see how to alert a wait<BR>
on Win9x. Maybe via some extra arbitrary async pipe i/o?<BR>
On NT it's just QueueUserAPC.<BR>
 <BR> - Jay<BR> <BR><BR>

<HR id=ecxstopSpelling>
<BR>
From: jay.krell@cornell.edu<BR>To: m3devel@elegosoft.com<BR>Date: Fri, 11 Dec 2009 14:05:56 +0000<BR>Subject: [M3devel] win32 AlertPause polls instead of one big wait?<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
Anyone know why Win32 AlertPause uses a polling loop instead of just one wait?<BR> <BR> <BR>I'm not sure this is going to work out, but:<BR>  I'm "rewriting" stuff to use a separate event for alerting.<BR>  alertable goes away<BR>  There will be two events: <BR>    waitEvent, for condition variables<BR>    alertEvent, for alerting <BR> <BR> <BR>roughly speaking:<BR> <BR> <BR>AlertPause: WaitForSingleObject(alertEvent)<BR>AlertWait:<BR>   alerted := WaitForMultipleObjects({alertEvent, waitEvent}) == WAIT_OBJECT_0)<BR>Alert(t): SetEvent(t.alertEvent);<BR>TestAlert: alerted := WaitForSingleObject(alertEvent, 0);<BR> <BR> <BR>It seems simple enough.<BR>That shows all the ingredients.<BR>That'll eliminate a lot of the global locking.<BR>And then one "last" iteration to use the Java code for condition variables and the global lock will be gone.<BR>You can't just use the Java code because it doesn't include alertability.<BR>You can't, I believe, draw a parallel to the pthreads code, because the Java code doesn't maintain a wait list with a mutex.<BR>The waiter/tickets/counter stuff is pretty clever -- I don't understand it yet..<BR> <BR> <BR> - Jay<BR><BR>                                         </body>
</html>