[cpp-threads] memory model
Peter Dimov
pdimov at mmltd.net
Thu May 5 18:35:46 BST 2005
Hans Boehm wrote:
> The intent is yes in all cases. It is currently an open problem how
> to state that in the current memory model. But I don't think anyone
> has thought about it for very long, yet.
But the current wording doesn't allow reordering in (2) and (3), if I'm not
mistaken?
> Hans
>
> On Thu, 5 May 2005, Peter Dimov wrote:
>
>> I have the following question about the proposed memory model:
>>
>> In the examples below:
>>
>> 1.
>>
>> r1 = atomic_load( &x );
>> r2 = y;
>>
>> 2.
>>
>> r1 = atomic_load( &x );
>> r2 = atomic_load( &y );
>>
>> 3.
>>
>> if( r1 = atomic_load( &x ) )
>> r2 = y;
>>
>> (note that the atomic loads do not have an associated ordering
>> constraint)
>>
>> is the compiler or the hardware allowed to reorder the two loads?
More information about the cpp-threads
mailing list