Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-04-24 13:04:09

From: "Bronek Kozicki"
> On Fri, 23 Apr 2004 11:12:27 +0200, Daniel Krügler wrote:
> > Reference linking is really great stuff in (single-thread) theory, but
> > unfortunatly it seems to have lots of difficulties in mt world. (At
> why are we trying to built thread-safety into shared_ptr? There is good
> saying that drove C++ to the point where we are right now: "do not pay
> for what you do not use". If I'm willing to provide own synchronization
> for shared pointers,

You can't. Not unless you control the entire program and you can determine
with certainty which shared_ptr instances share ownership at every
particular moment.

Well, you could do it with a global mutex just to prove the point, I

> or use it in single-threaded env, why would I need
> to pay extra heap allocation to make it play nice in mt world? Moreover,
> if I'm willing to use shared_ptr in mt env. and use its synchronization
> features, it does not provide synch. for pointee anyway. Thus I still
> need to provide my own synchroniozation to protect state of pointee.

Pointee synchronization is something that you can do yourself. And you
should, because only you know the locking granularity that is required by
the pointee.

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