Rename increment/decrement ref count APIs

This commit is contained in:
Josh Holtrop 2026-02-23 17:31:04 -05:00
parent c628177b94
commit 65c859030d

View File

@ -20,12 +20,12 @@ namespace rcp_internal
virtual ~root() = default; virtual ~root() = default;
public: public:
void add_ref() const void rcp_inc() const
{ {
ref_count.fetch_add(1, std::memory_order_relaxed); ref_count.fetch_add(1, std::memory_order_relaxed);
} }
void release_ref() const void rcp_dec() const
{ {
if (ref_count.fetch_sub(1, std::memory_order_acq_rel) == 0) if (ref_count.fetch_sub(1, std::memory_order_acq_rel) == 0)
{ {
@ -67,7 +67,7 @@ private:
{ {
if (p) if (p)
{ {
ptr->add_ref(); ptr->rcp_inc();
} }
} }
@ -80,7 +80,7 @@ public:
{ {
if (ptr) if (ptr)
{ {
ptr->add_ref(); ptr->rcp_inc();
} }
} }
@ -88,7 +88,7 @@ public:
{ {
if (ptr) if (ptr)
{ {
ptr->release_ref(); ptr->rcp_dec();
} }
} }
@ -98,7 +98,7 @@ public:
{ {
if (ptr) if (ptr)
{ {
ptr->add_ref(); ptr->rcp_inc();
} }
} }