貌似本版讨论过
shared_ptr是一个struct/class,其至少包含两个数据成员,一个计数器,一个raw ptr,所以针对shared_ptr的赋值(operator=导致的write)不是原子操作,必须另外加锁。
https://stackoverflow.com/questions/55693819/stdshared-ptr-in-one-writer-many-reader-design-is-thread-safe
--
修改:z16166 FROM 221.222.172.*
FROM 221.222.172.*