aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-12-08 06:22:55 -0800
committerChris Robinson <[email protected]>2022-12-08 06:22:55 -0800
commitb0be3bf883c147a87840b880a6b0a8db36333b6a (patch)
treea1c8bef78fe66a3d431609f3d3ffd3616790282e /common
parent4c2a96e2c856c07aead4ea5679d27310743b45ae (diff)
Rename a potentially confusing member function
Diffstat (limited to 'common')
-rw-r--r--common/intrusive_ptr.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/common/intrusive_ptr.h b/common/intrusive_ptr.h
index 5e65ba78..84d18aa0 100644
--- a/common/intrusive_ptr.h
+++ b/common/intrusive_ptr.h
@@ -15,7 +15,7 @@ class intrusive_ref {
public:
unsigned int add_ref() noexcept { return IncrementRef(mRef); }
- unsigned int release() noexcept
+ unsigned int dec_ref() noexcept
{
auto ref = DecrementRef(mRef);
if(ref == 0) [[unlikely]]
@@ -58,14 +58,14 @@ public:
{ rhs.mPtr = nullptr; }
intrusive_ptr(std::nullptr_t) noexcept { }
explicit intrusive_ptr(T *ptr) noexcept : mPtr{ptr} { }
- ~intrusive_ptr() { if(mPtr) mPtr->release(); }
+ ~intrusive_ptr() { if(mPtr) mPtr->dec_ref(); }
intrusive_ptr& operator=(const intrusive_ptr &rhs) noexcept
{
- static_assert(noexcept(std::declval<T*>()->release()), "release must be noexcept");
+ static_assert(noexcept(std::declval<T*>()->dec_ref()), "dec_ref must be noexcept");
if(rhs.mPtr) rhs.mPtr->add_ref();
- if(mPtr) mPtr->release();
+ if(mPtr) mPtr->dec_ref();
mPtr = rhs.mPtr;
return *this;
}
@@ -73,7 +73,7 @@ public:
{
if(&rhs != this) [[likely]]
{
- if(mPtr) mPtr->release();
+ if(mPtr) mPtr->dec_ref();
mPtr = std::exchange(rhs.mPtr, nullptr);
}
return *this;
@@ -88,7 +88,7 @@ public:
void reset(T *ptr=nullptr) noexcept
{
if(mPtr)
- mPtr->release();
+ mPtr->dec_ref();
mPtr = ptr;
}