4db Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Peter Dimov Date : Wed Apr 13 2005 10:33 pm Joe Seigh wrote: > On Wed, 13 Apr 2005 18:53:50 +0300, Peter Dimov > wrote: >> Joe Seigh wrote: >> >>> atomic_ptr/local_ptr is a modified weighted reference counting >>> scheme. local_ptr looks a lot like pure weighted reference >>> counting. >> >> From looking at the source, local_ptr doesn't seem weighted to me. >> There is no weight member and copies just increment a shared >> reference count (the ephemeral count). But maybe I'm not looking at >> the latest version (the one on atomic-ptr-plus.sf.net is 0.0.2). >> > Copying an atomic_ptr to a local ptr is a tranfer of 1 weighted > reference count without updating the central reference count. local_ptr > orginally weren't copyable since they only have a weight of > 1 but I added some logic from atomic_ptr to atomic_ptr copying, it's > just not as efficient. The extra logic obfuscates the weighted ptr > logic somewhat so it's hard to see. I see it now, thank you; there is an ecount in atomic_ptr. But even though I understand what the code does, I'm still puzzled as to what this scheme buys you. . 0