[vlc-devel] [PATCH 4/5] threads: move vlc_cancel_addr_set/clear in threads.c

Steve Lhomme robux4 at ycbcr.xyz
Fri Feb 7 16:02:09 CET 2020


It's only used there and this way we can use the proper type matching the
storage.
---
 include/vlc_threads.h | 10 ----------
 src/misc/threads.c    | 17 ++++++++++++++++-
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/include/vlc_threads.h b/include/vlc_threads.h
index 7ae25931b72..a5425236b1c 100644
--- a/include/vlc_threads.h
+++ b/include/vlc_threads.h
@@ -1100,16 +1100,6 @@ static inline void vlc_cleanup_lock (void *lock)
 }
 #define mutex_cleanup_push( lock ) vlc_cleanup_push (vlc_cleanup_lock, lock)
 
-static inline void vlc_cancel_addr_set(void *addr)
-{
-    vlc_control_cancel(VLC_CANCEL_ADDR_SET, addr);
-}
-
-static inline void vlc_cancel_addr_clear(void *addr)
-{
-    vlc_control_cancel(VLC_CANCEL_ADDR_CLEAR, addr);
-}
-
 #ifdef __cplusplus
 /**
  * Helper C++ class to lock a mutex.
diff --git a/src/misc/threads.c b/src/misc/threads.c
index 87c3da03d9e..7699cfae05d 100644
--- a/src/misc/threads.c
+++ b/src/misc/threads.c
@@ -149,11 +149,26 @@ bool vlc_mutex_marked(const vlc_mutex_t *mutex)
 #if defined(LIBVLC_NEED_SLEEP) || defined(LIBVLC_NEED_CONDVAR)
 #include <stdatomic.h>
 
+static inline void vlc_cancel_addr_set(atomic_int *addr)
+{
+    vlc_control_cancel(VLC_CANCEL_ADDR_SET, addr);
+}
+
+static inline void vlc_cancel_addr_clear(atomic_int *addr)
+{
+    vlc_control_cancel(VLC_CANCEL_ADDR_CLEAR, addr);
+}
+
+static void do_vlc_cancel_addr_clear(void *addr)
+{
+    vlc_cancel_addr_clear(addr);
+}
+
 static void vlc_cancel_addr_prepare(atomic_int *addr)
 {
     /* Let thread subsystem on address to broadcast for cancellation */
     vlc_cancel_addr_set(addr);
-    vlc_cleanup_push(vlc_cancel_addr_clear, addr);
+    vlc_cleanup_push(do_vlc_cancel_addr_clear, addr);
     /* Check if cancellation was pending before vlc_cancel_addr_set() */
     vlc_testcancel();
     vlc_cleanup_pop();
-- 
2.17.1



More information about the vlc-devel mailing list