If threads are unrelated (that is, not known to be in the same scope or one within the lifetime of the other) and they need to share free store memory that needs to be deleted, a shared_ptr (or equivalent) is the only safe way to ensure proper deletion.
如果线程之间没有关联(即,无法断定处于相同的作用域,或者一个线程处于另一个线程的生命周期中)而且共享需要删除的自由存贮内存,share_ptr(或等价物)是可以保证安全、正确地销毁内存的唯一方法。
Example(示例)
???
???
原文链接
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#cp31-pass-small-amounts-of-data-between-threads-by-value-rather-than-by-reference-or-pointer