summaryrefslogtreecommitdiff
path: root/core/safe_refcount.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/safe_refcount.h')
-rw-r--r--core/safe_refcount.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/safe_refcount.h b/core/safe_refcount.h
index f6b8f80271..47161eed57 100644
--- a/core/safe_refcount.h
+++ b/core/safe_refcount.h
@@ -177,23 +177,24 @@ struct SafeRefCount {
public:
// destroy() is called when weak_count_ drops to zero.
- _ALWAYS_INLINE_ bool ref() { //true on success
+ _ALWAYS_INLINE_ bool ref() { // true on success
return atomic_conditional_increment(&count) != 0;
}
- _ALWAYS_INLINE_ uint32_t refval() { //true on success
+ _ALWAYS_INLINE_ uint32_t refval() { // none-zero on success
return atomic_conditional_increment(&count);
}
_ALWAYS_INLINE_ bool unref() { // true if must be disposed of
- if (atomic_decrement(&count) == 0) {
- return true;
- }
+ return atomic_decrement(&count) == 0;
+ }
+
+ _ALWAYS_INLINE_ uint32_t unrefval() { // 0 if must be disposed of
- return false;
+ return atomic_decrement(&count);
}
_ALWAYS_INLINE_ uint32_t get() const { // nothrow