720 Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Joe Seigh Date : Thu Apr 14 2005 08:21 am On Thu, 14 Apr 2005 14:01:08 +0300, Peter Dimov wrote: > Joe Seigh wrote: >> I was going to say it is probably the only working atomic ptr out >> there. If you google for "Lock-free Reference Counting" you'll find a >> paper on on an implementation that requires an instruction no longer in >> existence. However google dragged up an article in the Dec 2004 CUJ >> titled "Atomic Reference Counting Pointers" by William K. Reinholtz >> which going by the code examples appears to be the same as the PPC >> version of atomic_ptr. I don't have access to the article itself so I >> don't know where he got >> the algorithm. Anyone know? > > Since it's in CUJ, you should probably ask in clc++m. William K. (Kirk) > Reinholtz has several RT-related papers, so if he doesn't give you credit in > the article, he probably invented it. > > By looking at > > ftp://ftp.cuj.com/pub/2004/cujdec2004.zip > > I'd say that it doesn't have much in common with your atomic_ptr. Macros vs > templates and the definition of CAS aside, atomic_ptr is non-intrusive, > Reinholtz's 'rcp' is intrusive; it relies on a cntr_ member in the pointee > to keep the count. It's like boost::intrusive_ptr with an atomic exchange in > the 'swap' member, except with most of the code inlined and some > over-atomicity in the constructors and the destructor. No match for your > atomic_ptr, IMO. > > The ppc version of atomic_ptr uses different interlocked logic since ppc doesn't have double wide CAS. The template vs. macros and intrusive vs. non-intrusive are just details. It's the underlying algorithms that matter. But I'll ask in clc++m. -- Joe Seigh . 0