[vlc-commits] vlc_atomic: Add a vlc_atomic_rc_get function
Hugo Beauzée-Luyssen
git at videolan.org
Thu Dec 17 15:19:46 UTC 2020
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Dec 16 14:29:06 2020 +0100| [5a6b9d32bde8420ae8a7fe26d46c0fb5e5b27857] | committer: Hugo Beauzée-Luyssen
vlc_atomic: Add a vlc_atomic_rc_get function
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5a6b9d32bde8420ae8a7fe26d46c0fb5e5b27857
---
include/vlc_atomic.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/vlc_atomic.h b/include/vlc_atomic.h
index d596259e12..ac0d5998aa 100644
--- a/include/vlc_atomic.h
+++ b/include/vlc_atomic.h
@@ -60,4 +60,12 @@ static inline bool vlc_atomic_rc_dec(vlc_atomic_rc_t *rc)
return prev == 1;
}
+/** Returns the current reference count.
+ * This is not safe to use for logic and must only be used for debugging or
+ * assertion purposes */
+static inline uintptr_t vlc_atomic_rc_get(const vlc_atomic_rc_t* rc)
+{
+ return atomic_load_explicit(&rc->refs, memory_order_relaxed);
+}
+
#endif
More information about the vlc-commits
mailing list