Is it thread safe to reset and copy shared_ptr simultaneously?
问题 Boost documentation describes shared pointer's behavior when accessing it from multiple threads simultaneously. Particularly they give some examples: shared_ptr<int> p(new int(42)); //--- Example 1 --- // thread A shared_ptr<int> p2(p); // reads p // thread B shared_ptr<int> p3(p); // OK, multiple reads are safe //--- Example 2 --- // thread A p.reset(new int(1912)); // writes p // thread B p2.reset(); // OK, writes p2 //--- Example 3 --- // thread A p = p3; // reads p3, writes p // thread B