I googled this question but, although there are many discussions about it, I didn't find a clear answer.
Can I assume the following piece of code to be thread safe?
shared_ptr<T> p1(new XXX); //Main thread weak_ptr<T> wp(sp); //Main thread //Then I run two threads: A and B p1.reset(); // thread A shared_ptr<T> p2 = wp.lock(); // thread BIn other words, is lock method atomic in respect to deference of the shared point?