<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
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> </body>
</html>