Boost logo

Boost :

From: Joachim Achtzehnter (joachim_at_[hidden])
Date: 2002-06-28 12:09:37


Terence Wilson wrote:
>
> Mmm. I understand that the actual object pointed to must be made thread
> safe, however, can I assume that shared_ptr is thread safe? i.e. it will
> correctly maintain use counters while being accessed from multiple
> threads?

No.

Making shared_ptr (or pretty much any object from the boost library)
threadsafe in this sense would impose a huge performance penalty on
programs (even multi-threaded ones) that don't need synchronization at
such a microscopic level.

On the other hand, it would certainly be useful to have the option of a
thread-safe shared_ptr. Perhaps we'll get this with a future standard
policy-based smart pointer... :-)

Joachim

-- 
work:     joachima_at_[hidden]   (http://www.netacquire.com)
private:  joachim_at_[hidden]          (http://www.kraut.ca)

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