Fully thread-safe shared_ptr implementation

后端 未结 9 1452
面向向阳花
面向向阳花 2021-02-02 17:02

Does anybody know of a fully thread-safe shared_ptr implementation? E.g. boost implementation of shared_ptr is thread-safe for the targets (refcounting

9条回答
  •  梦谈多话
    2021-02-02 17:47

    You can easily do this by including a mutex object with every shared pointer, and wrapping increment/decrement commands with the lock.

提交回复
热议问题