From 5a6b9d32bde8420ae8a7fe26d46c0fb5e5b27857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 16 Dec 2020 14:29:06 +0100
Subject: [PATCH] vlc_atomic: Add a vlc_atomic_rc_get function

---
 include/vlc_atomic.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/vlc_atomic.h b/include/vlc_atomic.h
index d596259e1209..ac0d5998aa57 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
-- 
GitLab