cptr::atomic_ptr

A compressed pointer that can be updated atomically.

Synopsis

Declared in <cptr/pack.hpp>

template<
    class T,
    class Cage = default_cage>
class atomic_ptr;

Description

It offers the parts of the std::atomic<T*> interface that apply to it (no arithmetic). Every pointer passed in must be null or point into the cage.

Member Functions

NameDescription
atomic_ptr [constructor]Constructors
operator= store(p), returning p like std::atomic<T*>::operator=.
compare_exchange_strong compare_exchange_strong overloads
compare_exchange_weak compare_exchange_weak overloads
exchange Replaces the pointer with p and returns the previous one, in one atomic step.
is_lock_free Whether this object's operations are lock-free.
load The current pointer.
notify_all Wakes all threads blocked in wait() on this object.
notify_one Wakes one thread blocked in wait() on this object, if any.
store Replaces the pointer with p.
wait Blocks until the value is no longer old (and a notify call wakes it).
operator T* load().

Static Data Members

NameDescription
is_always_lock_free True when the 32-bit offset is always updated without a lock.