Subj : Re: A question about atomic_ptr To : comp.programming.threads From : Peter Dimov Date : Wed Apr 13 2005 07:32 pm Alexander Terekhov wrote: > Peter Dimov wrote: > > [... weighted reference counting ...] > >> The reason I believe that this scheme is not a gain is that it >> eliminates count increments at the expense of an additional integer >> in every pointer. > > It does bring contention down a bit (at expense of extra space), > but you still need (naked) atomic operation. Consider: (basic > thread-safety) > > weighted_reference_counting_ptr w; > > Thread A: > > weighted_reference_counting_ptr a(w); > > Thread B: > > weighted_reference_counting_ptr b(w); > > Both threads need to update w's weight, oder? Yes (I posted something along these lines in clc++m). .