cycle_ptr
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
cycle_ptr::detail::generation Class Reference

Public Member Functions

auto link (base_control &bc) noexcept -> void
 
auto unlink (base_control &bc) noexcept -> void
 
auto seq () const noexcept -> std::uintmax_t
 
auto gc () noexcept -> void
 

Static Public Member Functions

static auto new_generation () -> intrusive_ptr< generation >
 
static auto new_generation (std::uintmax_t seq) -> intrusive_ptr< generation >
 
static auto order_invariant (const generation &origin, const generation &dest) noexcept -> bool
 
static auto fix_ordering (base_control &src, base_control &dst) noexcept -> std::shared_lock< std::shared_mutex >
 Ensure src and dst meet constraint, in order to create an edge between them. More...
 

Public Attributes

std::shared_mutex mtx_
 Mutex protecting controls_ and GC.
 
std::shared_mutex merge_mtx_
 Mutex protecting merges. More...
 
std::shared_mutex red_promotion_mtx_
 Lock to control weak red-promotions. More...
 

Friends

class cycle_ptr::gc_operation
 
auto intrusive_ptr_add_ref (generation *g) noexcept -> void
 
auto intrusive_ptr_release (generation *g) noexcept -> void
 

Member Function Documentation

◆ fix_ordering()

static auto cycle_ptr::detail::generation::fix_ordering ( base_control src,
base_control dst 
) -> std::shared_lock< std::shared_mutex >
staticnoexcept

Ensure src and dst meet constraint, in order to create an edge between them.

Ensures that either:

  1. order_invariant holds between generation in src and dst; or
  2. src and dst are in the same generation.
Returns
A lock to hold while creating the edge.

Member Data Documentation

◆ merge_mtx_

std::shared_mutex cycle_ptr::detail::generation::merge_mtx_

Mutex protecting merges.

Note
merge_mtx_ must be acquired before mtx_.

◆ red_promotion_mtx_

std::shared_mutex cycle_ptr::detail::generation::red_promotion_mtx_

Lock to control weak red-promotions.

When performing a weak red promotion, this lock must be held for share. The GC will hold this lock exclusively, to prevent red promotions.

Note that this lock is not needed when performing a strong red-promotion, as the promoted element is known reachable, thus the GC would already have processed it during phase 1.


The documentation for this class was generated from the following file: