Ove Kaaven <[EMAIL PROTECTED]> writes:

> OK, this code may look all fine and dandy, even for sendmessages. But what
> happens when an optimizing C compiler like gcc gets run on it? Well, it
> figures that the changeBits are tested at [2], so when it gets to [3], it
> sees no change, and optimizes [3] out... so, instant race condition.

It does not make any difference whether the compiler optimizes it out
or not, you still have the same race. And adding volatile doesn't
help, the bits can always be changed after they are tested (volatile
is almost always the wrong fix for a race condition anyway). All the
wake bits handling is broken IMO, this will be revisited when I get
around to implement inter-process SendMessage().

-- 
Alexandre Julliard
[EMAIL PROTECTED]

Reply via email to