Optimization of conditional access to globals: thread-unsafe?
Robert Dewar
dewar@adacore.com
Sat Oct 27 16:25:00 GMT 2007
Florian Weimer wrote:
> * Robert Dewar:
>
>>> In the following example, is the access to "Shared" considered
>>> unsynchronized even though what looks like a proper lock is used
>>> around it?
>> Yes, it is unsynchronized. Why would you think otherwise?
>
> The signaling rules are dynamic, not static. Only the code path that is
> actually taken matters. Sam's corrected code only updates Shared if the
> operation in other tasks have been signaled (because of the entry_body
> rule and the sequence rule).
I don't understand, are we looking at the same example, the example
from Sam that I looked at did not have an entry body, so how could the
entry body rule apply?
>
> (I can't reproduce the conditional store with my GCC 4.2 installation,
> though.)
More information about the Gcc
mailing list