P
Pete Becker
Joe said:That's a known issue. The usual solution is to use atomic types
with the right guarantees, i.e. atomicity and acquire or release
semantics if needed. STL don't use atomic types so you don't know
if they can be used in this way since it's compiler and platform
dependent.
Yes, that is the point of the example.
The more insideous problem is you can't just arbitrarily move things
around and expect that the proper semantics will hold.
It's essentially the same issue: if you don't have a guarantee of
atomicity, all bets are off. (Unless you have some other eplicit guarantee)