Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-02-05 19:21:19

"David B. Held" wrote:
> "Pavel Vasiliev" <pavel_at_[hidden]> wrote in message
> > [...]
> > In my implementation of refc_ptr operator= performs
> > incrementing/decrementing within a single guarded section (since
> > the only global instance of interl. op. mutex is used for all

> > cases). So the copying via operator= is about twice faster in my
> > implementation.

Really? What about contention? Well, it's a nice way to play
ping-pong on a multiprocessor system... or am I just missing
and/or misunderstanding something?

> > I do not know how to achieve this with
> > Loki::SmartPtr.
> >
> > The true locking/unlocking, not InterlockedIncrement/Decrement()

Nah, pthread_refcount_t. ;-)

> > even if availabe, is necessary to support weak references.
> > [...]
> Well, this is a good point, and is worthy of study at some point.

It's probably a bit more exciting to take care of all possible races
without "a true lock" protecting both counters. I'm not sure that the
true locking is *necessary* to support weak references. Do you have
an illustration, Pavel?


Boost list run by bdawes at, gregod at, cpdaniel at, john at