Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-04-25 20:34:01


From: "Howard Hinnant"
> On Apr 25, 2004, at 7:00 AM, John Maddock wrote:
>
> > Maybe, but lets not forget that shared_ptr doesn't need a mutex at
> > all, what
> > it needs is an atomic counter (actually less than that, because we
> > never
> > need the value of the counter just whether it's less than/greater
> > than, or
> > equal to zero).
>
> shared_ptr has two counts which sometimes must both be incremented in
> an atomic fashion.

Right, but thanks to Alexander Terekhov, this is already a solved problem.
:-) I'll try to switch boost::shared_ptr to use atomic operations (on
Windows at least) for the next release. Perhaps you missed the comp.std.c++
thread and my proof of concept implementation, available at

http://www.pdimov.com/cpp/shared_count_x86_exp2.hpp


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk