[cpp-threads] Memory model question

Peter Dimov pdimov at mmltd.net
Fri Aug 26 22:58:56 BST 2005


Boehm, Hans wrote:

>> In fact,
>> 
>> if( y != 0 )
>> {
>>     x += y;
>> }
>> 
>> can be transformed to x += y (at source level) under the alternate
>> interpretation, but not under the original.

> I don't understand this comment.
> 
> Assume a second thread does ++x; and y is always zero.

You are right, the transformation is not allowed. I was mistaken.




More information about the cpp-threads mailing list