An atomically‐swappable owner of a ReadMostlyMainPtr.

Synopsis

Declared in <folly/concurrency/memory/AtomicReadMostlyMainPtr.h>

template<typename T>
class AtomicReadMostlyMainPtr;

Description

What atomic_shared_ptr is to shared_ptr, this is to ReadMostlyMainPtr: it allows racy conflicting accesses to one, giving true shared_ptr‐like semantics, including reclamation at the point where the last pointer to an object goes away. It runs at about the same speed as ReadMostlyMainPtr and avoids reader‐reader contention and atomic RMWs in the absence of writes.

Member Functions

Name

Description

AtomicReadMostlyMainPtr [constructor]

Constructors

operator=

Atomically replaces the held pointer.

compare_exchange_strong

Atomically replaces the held pointer if it equals the expected one.

compare_exchange_weak

Atomically replaces the held pointer if it equals the expected one.

exchange

Atomically replaces the held pointer and returns the previous one.

is_lock_free

Reports whether operations on this object are lock‐free.

load

Atomically reads the held pointer.

store

Atomically replaces the held pointer.

Template Parameters

Name

Description

T

The pointee type.

Created with MrDocs