folly::atomic_shared_ptr

Atomic wrapper around std::shared_ptr providing lock-free style operations.

Synopsis

Declared in <folly/concurrency/AtomicSharedPtr.h>

template<typename T>
class atomic_shared_ptr;

Description

This fallback implementation forwards to the standard library's free function atomic operations on shared_ptr.

Type Aliases

NameDescription
value_type The underlying shared_ptr type stored by this wrapper.

Member Functions

NameDescription
atomic_shared_ptr [constructor]Constructors
operator= Assignment operators
compare_exchange_strong Atomically compares and, on success, stores a new value without spurious failures.
compare_exchange_weak Atomically compares and, on success, stores a new value, possibly failing spuriously.
exchange Atomically replaces the stored value and returns the previous one.
is_lock_free Reports whether operations on this object are lock-free.
load Atomically loads the stored shared_ptr.
store Atomically stores a new shared_ptr value.
operator std::shared_ptr<T> Atomically loads the stored shared_ptr.

Deduction Guides

NameDescription
atomic_shared_ptr<T> Deduction guide for constructing atomic_shared_ptr from a shared_ptr.