|
cycle_ptr
|
Base class for all control blocks. More...
#include <base_control.h>


Classes | |
| class | publisher |
| Address range publisher. More... | |
Public Member Functions | |
| auto | expired () const noexcept -> bool |
| Test if the object managed by this control is expired. | |
| auto | weak_acquire () noexcept -> bool |
| Used by weak to strong reference promotion. More... | |
| auto | acquire_no_red () noexcept -> void |
| Acquire reference. More... | |
| auto | acquire () noexcept -> void |
| Acquire reference. More... | |
| auto | release (bool skip_gc=false) noexcept -> void |
| Release reference counter. More... | |
| auto | gc () noexcept -> void |
| Run GC. | |
| auto | push_back (vertex &v) noexcept -> void |
| Register a vertex. | |
| auto | erase (vertex &v) noexcept -> void |
| Deregister a vertex. | |
| virtual auto | is_unowned () const noexcept -> bool |
| Test if this control block represents an unowned object. | |
Public Member Functions inherited from cycle_ptr::detail::link< base_control > | |
| constexpr | link () noexcept=default |
| Default constructor. | |
| ~link () noexcept | |
| Destructor. | |
Static Public Member Functions | |
| static auto | unowned_control () -> intrusive_ptr< base_control > |
| Create a control block that represents no ownership. | |
| static auto | publisher_lookup (void *addr, std::size_t len) -> intrusive_ptr< base_control > |
| Implements publisher lookup based on address range. | |
Public Attributes | |
| bool | under_construction = true |
| This variable indicates the managed object is under construction. More... | |
Protected Member Functions | |
| base_control () | |
| Default constructor allocates a new generation. | |
| base_control (intrusive_ptr< generation > g) noexcept | |
| Constructor to use a specific generation. | |
| ~base_control () noexcept | |
| Destructor. | |
Protected Member Functions inherited from cycle_ptr::detail::link< base_control > | |
| constexpr | link ([[maybe_unused]] const link &other) noexcept |
| Constructor. More... | |
| constexpr auto | operator= ([[maybe_unused]] const link &other) noexcept -> link & |
| Assignment. More... | |
| constexpr auto | linked () const noexcept -> bool |
| Test if this is linked into a linked list. More... | |
Friends | |
| class | generation |
| class | vertex |
| template<typename > | |
| class | cycle_ptr::cycle_allocator |
| auto | intrusive_ptr_add_ref (base_control *bc) noexcept -> void |
| Increment reference counter. More... | |
| auto | intrusive_ptr_release (base_control *bc) noexcept -> void |
| Decrement reference counter. More... | |
Base class for all control blocks.
Contains all variables required for the algorithm to function.
|
noexcept |
Acquire reference.
Increments the reference counter.
May only be called on reachable instances of this.
|
inlinenoexcept |
Acquire reference.
May only be called when it is certain there won't be red promotion involved (meaning, it's certain that the reference counter is greater than zero).
Faster than acquire().
|
inlinenoexcept |
Release reference counter.
Reference counter is decremented by one. If the reference counter drops to zero, a GC invocation will be performed, unless skip_gc is set.
| skip_gc | Flag to suppress GC invocation. May only be set to true if caller can guarantee that this is live. |
|
noexcept |
Used by weak to strong reference promotion.
|
friend |
Increment reference counter.
Used by intrusive_ptr.
|
friend |
Decrement reference counter.
Used by intrusive_ptr. Destroys this if the last reference goes away.
| bool cycle_ptr::detail::base_control::under_construction = true |
This variable indicates the managed object is under construction.
It is used to prevent base_control::shared_from_this from handing out references until construction has completed.
If a pointer was handed out before, we would get into a difficult scenario where the constructor of an object could publish itself and then fail its construction later. At which point we would have the difficult question of how to manage a dangling pointer.
By preventing this, we prevent failed constructors from accidentally publishing an uninitialized pointer.
1.8.15