22 Jul
2009
22 Jul
'09
7:38 p.m.
It's safe, presuming your "p" in thread A is a different shared_ptr object from the "p" reset in thread B. They can safely be copies sharing ownership of the same object.
Oh, sorry for the confusing example, it should be more clear: //thread A: shared_ptr<Foo> a = wp.lock(); //wp is a weak pointer for p from thread B //thread B: p.reset(); What I'm actually asking about whether it's thread safe to call simultaneously wp.lock() in one thread and p.reset() in another one. -- Best regards, Pavel