]> git.sesse.net Git - vlc/blobdiff - src/misc/threads.c
Rename the sdi module to decklink.
[vlc] / src / misc / threads.c
index 291b3f3437c6d03fe27ef5b6b55d1e8e51135429..fd84ad7270cc94de9779719290817947eacda60b 100644 (file)
@@ -100,12 +100,13 @@ int vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line,
     return i_ret;
 }
 
+#undef vlc_thread_set_priority
 /*****************************************************************************
  * vlc_thread_set_priority: set the priority of the current thread when we
  * couldn't set it in vlc_thread_create (for instance for the main thread)
  *****************************************************************************/
-int __vlc_thread_set_priority( vlc_object_t *p_this, const char * psz_file,
-                               int i_line, int i_priority )
+int vlc_thread_set_priority( vlc_object_t *p_this, const char * psz_file,
+                             int i_line, int i_priority )
 {
     vlc_object_internals_t *p_priv = vlc_internals( p_this );
 
@@ -164,10 +165,11 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, const char * psz_file,
     return 0;
 }
 
+#undef vlc_thread_join
 /*****************************************************************************
  * vlc_thread_join: wait until a thread exits, inner version
  *****************************************************************************/
-void __vlc_thread_join( vlc_object_t *p_this )
+void vlc_thread_join( vlc_object_t *p_this )
 {
     vlc_object_internals_t *p_priv = vlc_internals( p_this );
 
@@ -231,3 +233,25 @@ void vlc_thread_cancel (vlc_object_t *obj)
     if (priv->b_thread)
         vlc_cancel (priv->thread_id);
 }
+
+/*** Global locks ***/
+
+void vlc_global_mutex (unsigned n, bool acquire)
+{
+    static vlc_mutex_t locks[] = {
+        VLC_STATIC_MUTEX,
+        VLC_STATIC_MUTEX,
+        VLC_STATIC_MUTEX,
+    };
+    assert (n < (sizeof (locks) / sizeof (locks[0])));
+    vlc_mutex_t *lock = locks + n;
+
+    if (acquire)
+        vlc_mutex_lock (lock);
+    else
+        vlc_mutex_unlock (lock);
+
+    /* Compile-time assertion ;-) */
+    char enough_locks[(sizeof (locks) / sizeof (locks[0])) - VLC_MAX_MUTEX];
+    (void) enough_locks;
+}