[cpp-threads] N2052 sequencing revisions & examples(moderatelylong)

Boehm, Hans hans.boehm at hp.com
Fri Mar 9 18:55:26 GMT 2007


> -----Original Message-----
> From: cpp-threads-bounces at decadentplace.org.uk 
> [mailto:cpp-threads-bounces at decadentplace.org.uk] On Behalf 
> Of Peter Dimov
> Sent: Friday, March 09, 2007 7:33 AM
> To: C++ threads standardisation
> Subject: Re: [cpp-threads] N2052 sequencing revisions & 
> examples(moderatelylong)
> 
> I'd like the example
> 
> fetchadd_acquire( &x, 1 );
> load_relaxed( &y ); // 0
> 
> //
> 
> fetchadd_acquire( &y, 1 );
> load_relaxed( &x ); // 0
> 
> to be added and analyzed, if possible. If it doesn't permit 
> the non-SC (0,0) outcome, _acquire would (probably) be much 
> heavier than typically needed. 
> 
I'm not sure I see what you're getting at.

But currently this example gives rise to no synchronizes-with
relationships and hence no inter-thread happens-before relationships
(except from the default initializations to the loads).  Hence there is
nothing to preclude the non-SC outcome.

In this model, any use of acquire or release can be changed to relaxed
if there is no matching release or acquire in another thread.  This
allows aggressive compiler synchronization removal, but means you cannot
rely on the fence-based implementations some people expect.

Hans




More information about the cpp-threads mailing list