Kevin Frey wrote:
2. One thread A creating another shared_ptr to the shared object, attempting to increment the reference count.
3. Another thread B simultaneously destroying a *different* shared_ptr which is connected to the same underlying shared object, decrementing the reference count.
This is OK. Manipulating different shared_ptr instances in different threads is fine. The example states that you can't, in thread B, destroy the shared_ptr which thread A copies (*sp_Session in your code). Destroying other shared_ptr instances is allowed, regardless of whether or with what they share ownership. The thread safety rules work on shared_ptr instances, not on their pointees. You can replace shared_ptr with std::string (or even int) in the examples and they will be equally valid (provided that reset is replaced with assignment). (Although I admit that the variable names are used somewhat loosely.)