Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Joe Seigh Date : Mon Apr 11 2005 08:50 am On Mon, 11 Apr 2005 14:26:44 +0300, Peter Dimov wrote: > Alexander Terekhov wrote: >> Peter Dimov wrote: >>> >>> Yes, exactly, but why acquire in the increment? >> >> In your vocabulary, he means copy(). Your copy() does need acquire >> semantics to ensure visibility of client object "published" by your >> replace(). > > No, no. > > This is about local_shared_ptr, not about copy/replace. The > local_shared_ptrs in an ownership group (which needs to be local to a > specific thread) use a local unsynchronized reference count to keep track of > their single shared_ptr-like reference into the shared_ptr group. ChrisX got > it right, but I still think that there's no need to acquire in the > increment, it's an ordinary 'add_ref_strong'. As a practical matter I don't think you're going to have have more than one local pointer copy of a global shared pointer often enought to justify the extra overhead of maintaining a separate reference count and of the extra indirection. -- Joe Seigh .