[cpp-threads] Failed compare-and-swap

Boehm, Hans hans.boehm at hp.com
Fri Aug 3 01:15:04 BST 2007


  

> -----Original Message-----
> From: cpp-threads-bounces at decadentplace.org.uk 
> [mailto:cpp-threads-bounces at decadentplace.org.uk] On Behalf 
> Of Nelson, Clark
> Sent: Thursday, August 02, 2007 3:43 PM
> To: C++ threads standardisation
> Subject: Re: [cpp-threads] Failed compare-and-swap
> 
> > Are there any objections to the following compare-and-swap?
> > Basically, it adds another parameter specifying the memory 
> > synchronization for the load-only-write-did-not-happen case.
> 
> Are there reasonable ways on existing implementations to 
> implement the full flexibility of this? It seems pretty 
> inventive to me.
> 
The general philosophy here is to let the user specify in gory detail
what's required, and the compiler provides the cheapest implementation
that's at least strong enough.  I think that on most real
implementations some of the different options will always result in
identical code.  That clearly becomes more true with this proposal.

My impression is that we really want a way to drop the acquire
constraint on failure.  Doing so often saves you a fence in the failure
case.  We have no way to say that with a single ordering argument.  We
could instead specify it with a boolean, in addition to the standard
ordering constraint.  But that seems more confusing to me than two
ordering constraints.

Hans



More information about the cpp-threads mailing list