Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-11-17 06:43:00


Or Peles wrote:
[...]
> Moving the shared_ptr assignment out of the concurrent part (e.g. instead of
> two assignments from concurrent threads a single assignment before the
> multithreaded part) gave me a tenfold increase in performance.
>
> Is this reasonable?

Totally broken "boosted-lightweight" mutex stuff aside for a moment,
you can't have concurrent assignments unless your have a smart pointer
that provides "strong" thread safety (some people call it atomic_ptr).
The last time I've looked at it, the boost::shared_ptr was providing
"basic" thread-safety, not strong. Or, perhaps, you mean concurrent
COPYING where your source is read-only-shared smart pointer instance?

Try

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

then.

regards,
alexander.


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