這問題一直是讓我很難理解
我看了 cppreference, 他提到 你只要用了non-const method的話就不thread safe
問題出在
https://en.cppreference.com/w/cpp/memory/shared_ptr/operator%3D
這不是non-const , 而我看到的程式碼(也許早就寫錯了)
我並沒有看到mutex or 一些保護機制去保護shared_ptr assignment
假設一個情況
Thread1
mSp = nullptr; 內部應該是refcount