[cpp-threads] Failed compare-and-swap

Paul E. McKenney paulmck at linux.vnet.ibm.com
Mon Jul 30 23:08:44 BST 2007


On Tue, Jul 31, 2007 at 12:45:05AM +0300, Peter Dimov wrote:
> Lawrence Crowl wrote:
> > On 7/29/07, Peter Dimov <pdimov at mmltd.net> wrote:
> >> Lawrence Crowl wrote:
> >>> Are the synchronization semantics of a failed compare-and-swap
> >>> any different from those of a successful one?
> >>
> >> I think that a failed CAS should not be required to perform any
> >> memory synchronization.
> >
> > At the very least, the memory model needs to say something about
> > any value read.  Should we say it is equivalent to load relaxed?
> > (I'm not sure how that plays with the folks that want to program
> > to sequential consistency.)
> 
> A seq_cst CAS should probably still be sequentially consistent even in the 
> failure case, or it would break the SC model. 

OK, should we make the same restriction for trylock?  Might not be a
bad idea, actually...

						Thanx, Paul



More information about the cpp-threads mailing list