<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Tony can you clarify/confirm where you think the race is?<BR>
<BR>
<BR>
Is it here:<BR>
<BR>
<BR>
PROCEDURE InnerWait(m: Mutex; c: Condition; self: T) =<BR> (* LL = giant+m on entry; LL = m on exit *)<BR> BEGIN<BR> <* ASSERT( (self.waitingOn=NIL) AND (self.nextWaiter=NIL) ) *><BR>
self.waitingOn := c;<BR> self.nextWaiter := c.waiters;<BR> c.waiters := self;<BR>
m.release();<BR> LeaveCriticalSection_giant();<BR>
<BR>
** here ** ?<BR>
<BR> IF perfOn THEN PerfChanged(State.waiting) END;<BR> IF WaitForSingleObject(self.waitSema, INFINITE) # 0 THEN<BR> Choke(ThisLine());<BR> END;<BR> m.acquire();<BR> END InnerWait;<BR><BR>
Btw..just in case.. alerted and alertable could be "interlocked", even share bits in the same long.<BR>
If that helps.<BR>
<BR>
Another thing to consider is that Win32 reserves the lower two bits of handles for users.<BR>
So you can imagine something even like where waitSema is in two places.<BR>
One place where it isn't used, always there.<BR>
Another place where if it is non-null it is going to be waited on.<BR>
You could merge setting of that copy of waitSema with the two bits alerted and alertable.<BR>
And set all three in one fell interlocked swoop.<BR>
Does that help?<BR>
<BR>
<BR>
I'm just mentioning random tricks, without understanding where the race is.<BR>
<BR>
<BR>
I'm just hoping you don't need a lock free manipulation of the waiters list.<BR>
That I have no good ideas on.<BR>
There is the slist stuff but I'm not keen on it, and I don't think it buys anything.<BR>
<BR>
<BR>
- Jay<BR>
<BR><BR><BR><BR><BR> <BR> </body>
</html>