[cpp-threads] Web site updated

Peter Dimov pdimov at mmltd.net
Thu Feb 15 18:04:54 GMT 2007


Raul Silvera wrote:
> Peter Dimov wrote on 02/13/2007 03:22:52 PM:
>
>> Similarly,
>>
>> atomic_fetchadd_relaxed( &cnt, r );
>> atomic_fetchadd_relaxed( &cnt, -r );
>>
>> should be a noop, even for _ordered.
>>
>
> I certainly agree with this for _relaxed, but not for ordered.
> Ordered says that the second fetchadd cannot be done until after the
> first one has been made visible, so the implicit barrier will prevent
> the updates from being merged and removed.

I agree for an "ordered" that implies a #StoreLoad, and don't agree for an 
"ordered" that does not.

> Furthermore, I think such
> a mechanism is what should be used (instead of volatile) when users
> insist on relying on the intermediate values becoming visible to
> other threads. In this case, simply making the first fetchadd
> _release should be sufficient to prevent the two operations from
> being combined.

I don't believe that _release implies a #StoreLoad, so I disagree about 
_release being non-combineable. A store_release could conceivably be 
coalesced by the hardware write queue in the absence of #StoreLoad, so why 
not by the compiler? 




More information about the cpp-threads mailing list