Boost logo

Boost :

From: Terence Wilson (tez_at_[hidden])
Date: 2002-06-28 09:57:00


I'm having some trouble with a container of shared_ptr's shared between
threads. I'm seeing a crash during a pointer access. I have code
something like this:
 
thread 1
 
shared_ptr<CThing> pThing(new CThing);
.
.
pThing->DoSomething();
.
.
pThing=shared_ptr<CThing>(new CThing)
 
 
thread 2
 
pThing=shared_ptr<CThing>(new CThing)
.
.
pThing->DoSomethingElse();
 
I'm using boost 1_28, Visual Studio 7 and just include the header as
follows:

#include <boost/smart_ptr.hpp>

I don't build the library or declare any symbols.

Is there there something special I need to do to make shared_ptr thread
safe? Or am I barking up the wrong tree in terms of my thread safety
expectations?

Thanks,

Terence.



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