]> git.sesse.net Git - vlc/blobdiff - include/vlc_threads.h
barrier: avoid staticity and pthread-specificity
[vlc] / include / vlc_threads.h
index df7107e68e8c66de745660c4e8e48c49232784a8..ad1f80bd3c3b4f2184d59094e4fb7d0f001cb423 100644 (file)
@@ -565,12 +565,12 @@ static inline void barrier (void)
     asm volatile ("sync":::"memory");
 #elif defined(__i386__)
     asm volatile ("mfence":::"memory");
-#elif defined (LIBVLC_USE_PTHREAD)
-    static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-    pthread_mutex_lock (&lock);
-    pthread_mutex_unlock (&lock);
 #else
-# error barrier not implemented!
+    vlc_spin_t spin;
+    vlc_spin_init (&spin);
+    vlc_spin_lock (&spin);
+    vlc_spin_unlock (&spin);
+    vlc_spin_destroy (&spin);
 #endif
 }