Atomic Smart Pointers
A std::shared_ptr
consists of a control block and its resource. The control block is thread-safe, but access to the resource is not. This means modifying the reference counter is an atomic operation and you have the guarantee that the resource is deleted exactly once. These are the guarantees std::shared_ptr
gives you.
The proposal N4162 for atomic smart pointers directly addresses the deficiencies...