cycle_ptr
|
Hazard pointer. More...
#include <hazard.h>
Public Types | |
using | element_type = T |
Element type of the pointer. | |
using | pointer = typename hazard_t::pointer |
Smart pointer equivalent. | |
using | value_type = pointer |
Type held in this atomic. | |
Public Member Functions | |
auto | is_lock_free () const noexcept -> bool |
Test if this instance is lock free. | |
auto | is_lock_free () const volatile noexcept -> bool |
Test if this instance is lock free. | |
hazard_ptr () noexcept=default | |
Default constructor initializes to nullptr. | |
hazard_ptr (const hazard_ptr &p) noexcept | |
Copy construction. | |
hazard_ptr (hazard_ptr &&p) noexcept | |
Move construction. | |
hazard_ptr (pointer &&p) noexcept | |
Initializing constructor. More... | |
hazard_ptr (const pointer &p) noexcept | |
Initializing constructor. More... | |
~hazard_ptr () noexcept | |
Destructor. More... | |
auto | operator= (const hazard_ptr &p) noexcept -> pointer |
Copy assignment. More... | |
auto | operator= (hazard_ptr &&p) noexcept -> pointer |
Move assignment. More... | |
auto | operator= (const pointer &p) noexcept -> pointer |
Copy assignment. More... | |
auto | operator= (pointer &&p) noexcept -> pointer |
Move assignment. More... | |
auto | operator= ([[maybe_unused]] const std::nullptr_t nil) noexcept -> pointer |
nullptr assignment. More... | |
auto | reset () noexcept -> void |
Reset this. More... | |
auto | reset ([[maybe_unused]] std::nullptr_t nil) noexcept -> void |
Reset this. More... | |
auto | reset (pointer &&p) noexcept -> void |
Assignment. More... | |
auto | reset (const pointer &p) noexcept -> void |
Assignment. More... | |
operator pointer () const noexcept | |
Automatic conversion to pointer. | |
auto | get () const noexcept -> pointer |
Read the value of this. More... | |
auto | load () const noexcept -> pointer |
Read the value of this. More... | |
auto | store (pointer &&p) noexcept -> void |
Assignment. More... | |
auto | store (const pointer &p) noexcept -> void |
Assignment. More... | |
auto | exchange (pointer &&p) noexcept -> pointer |
Exchange operation. More... | |
auto | exchange (const pointer &p) noexcept -> pointer |
Exchange operation. More... | |
auto | compare_exchange_weak (pointer &expected, pointer desired) noexcept -> bool |
Weak compare-exchange operation. | |
auto | compare_exchange_strong (pointer &expected, pointer desired) noexcept -> bool |
Strong compare-exchange operation. | |
Friends | |
auto | operator== (const hazard_ptr &x, std::nullptr_t y) noexcept -> bool |
Equality comparison. | |
auto | operator== (const hazard_ptr &x, std::add_const_t< T > *y) noexcept -> bool |
Equality comparison. | |
template<typename U > | |
auto | operator== (const hazard_ptr &x, const intrusive_ptr< U > &y) noexcept -> std::enable_if_t< std::is_convertible_v< U *, T * >, bool > |
Equality comparison. | |
auto | operator== (std::nullptr_t x, const hazard_ptr &y) noexcept -> bool |
Equality comparison. | |
auto | operator== (std::add_const_t< T > *x, const hazard_ptr &y) noexcept -> bool |
Equality comparison. | |
template<typename U > | |
auto | operator== (const intrusive_ptr< U > &x, const hazard_ptr &y) noexcept -> std::enable_if_t< std::is_convertible_v< U *, T * >, bool > |
Equality comparison. | |
auto | operator!= (const hazard_ptr &x, std::nullptr_t y) noexcept -> bool |
Inequality comparison. | |
auto | operator!= (const hazard_ptr &x, std::add_const_t< T > *y) noexcept -> bool |
Inequality comparison. | |
template<typename U > | |
auto | operator!= (const hazard_ptr &x, const intrusive_ptr< U > &y) noexcept -> std::enable_if_t< std::is_convertible_v< U *, T * >, bool > |
Inequality comparison. | |
auto | operator!= (std::nullptr_t x, const hazard_ptr &y) noexcept -> bool |
Inequality comparison. | |
auto | operator!= (std::add_const_t< T > *x, const hazard_ptr &y) noexcept -> bool |
Inequality comparison. | |
template<typename U > | |
auto | operator!= (const intrusive_ptr< U > &x, const hazard_ptr &y) noexcept -> std::enable_if_t< std::is_convertible_v< U *, T * >, bool > |
Inequality comparison. | |
Hazard pointer.
Implements an atomic, reference-counted pointer.
Uses the same rules as intrusive_ptr with regards to acquiring and releasing reference counter.
|
inlinenoexcept |
Initializing constructor.
p
.p
== nullptr
|
inlinenoexcept |
Initializing constructor.
p
|
inlinenoexcept |
Destructor.
Releases the held pointer.
|
inlinenoexcept |
Exchange operation.
p | New value of this. |
p
p
== nullptr
|
inlinenoexcept |
Exchange operation.
p | New value of this. |
p
|
inlinenoexcept |
Read the value of this.
Marked [[nodiscard]]
, as there's no point in reading the pointer if you're not going to evaluate it.
|
inlinenoexcept |
Read the value of this.
Marked [[nodiscard]]
, as there's no point in reading the pointer if you're not going to evaluate it.
|
inlinenoexcept |
Copy assignment.
|
inlinenoexcept |
Move assignment.
p
p
== nullptr
|
inlinenoexcept |
Copy assignment.
p
p
|
inlinenoexcept |
Move assignment.
p
p
p
== nullptr
|
inlinenoexcept |
nullptr assignment.
|
inlinenoexcept |
Reset this.
|
inlinenoexcept |
Reset this.
|
inlinenoexcept |
Assignment.
p
p
== nullptr
|
inlinenoexcept |
Assignment.
p
|
inlinenoexcept |
Assignment.
p
p
== nullptr
|
inlinenoexcept |
Assignment.
p