Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Peter Dimov Date : Thu Apr 14 2005 05:53 pm Joe Seigh wrote: > The atomic swap is one part. The other part is safely incrementing > the reference count without "owning" it first. There's the DWCAS > solution, the PPC solution, and various GC based solutions using RCU, > SMR, etc... And of course the 2CAS solution which only works on > MC68020 and MC68030 processors. You mean the race between atomic_ptr p2( p1 ); and p1 = 0; ? I think that you have a bug in your PPC implementation, but I may be missing something. In inc_ref, you reload the pointer and check for change, however, the pointer is a local function argument (int* refcnt) and will never change. And you are right that Reinholz uses the same algorithm, except he passes an int** (the offset hack aside). .