Archives:

c++ why std::shared_ptr need atomic_store, atomic_load or why we need atomic shared_ptr 5/5 (1)

shared_ptr is some sort of confusing especially why we need atomic_store, atomic_load on that. It is NOT thread safe. In fact,  the primary intended use of std::shared_ptr is letting multiple threads control the lifetime of the same object, but not thread-safe. A good summary is: A shared_ptr behaves like a built-in type regarding thread-safety, Concurrent access to distinct • Read More »