Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-11-17 08:49:06


Alexander Terekhov wrote:
> 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,

Yep. "Totally broken" unfortunately looks like an accurate assessment of the
situation.

> 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.

... and please report the results. It would also help if you can try the
same test with #define BOOST_LWM_USE_CRITICAL_SECTION.

Thanks in advance.


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