...

/

Atomic Operations on std::shared_ptr

Atomic Operations on std::shared_ptr

We'll cover the following...

There are specializations for the atomic operations load, store, compare, and exchange for an std::shared_ptr. By using the explicit variant, you can even specify the memory model. Here are the free atomic operations for std::shared_ptr:

Press + to interact
std::atomic_is_lock_free(std::shared_ptr)
std::atomic_load(std::shared_ptr)
std::atomic_load_explicit(std::shared_ptr)
std::atomic_store(std::shared_ptr)
std::atomic_store_explicit(std::shared_ptr)
std::atomic_exchange(std::shared_ptr)
std::atomic_exchange_explicit(std::shared_ptr)
std::atomic_compare_exchange_weak(std::shared_ptr)
std::atomic_compare_exchange_strong(std::shared_ptr)
std::atomic_compare_exchange_weak_explicit(std::shared_ptr)
std::atomic_compare_exchange_strong_explicit(std::shared_ptr)

For the details, ...