Fix previous commit
authorRémi Denis-Courmont <rem@videolan.org>
Mon, 21 Jan 2008 19:24:25 +0000 (19:24 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Mon, 21 Jan 2008 19:24:25 +0000 (19:24 +0000)
include/vlc_threads.h
include/vlc_threads_funcs.h

index 31b851c..bc12b17 100644 (file)
@@ -58,6 +58,7 @@
 #   define LIBVLC_USE_PTHREAD 1
 #   define _APPLE_C_SOURCE    1 /* Proper pthread semantics on OSX */
 
+#   include <unistd.h> /* _POSIX_SPIN_LOCKS */
 #   include <pthread.h>
     /* Needed for pthread_cond_timedwait */
 #   include <errno.h>
index 5eb2ff3..a5d8143 100644 (file)
@@ -813,7 +813,7 @@ typedef struct
  */
 static inline int vlc_spin_init (vlc_spinlock_t *spin)
 {
-    return pthread_spin_init (&spin, PTHREAD_PROCESS_PRIVATE);
+    return pthread_spin_init (&spin->spin, PTHREAD_PROCESS_PRIVATE);
 }
 
 /**
@@ -842,7 +842,12 @@ static inline int vlc_spin_destroy (vlc_spinlock_t *spin)
 #else
 /* Fallback to plain mutexes if spinlocks are not available */
 typedef vlc_mutex_t vlc_spinlock_t;
-# define vlc_spin_init    vlc_mutex_init
+
+static inline int vlc_spin_init (vlc_spinlock_t *spin)
+{
+    return vlc_mutex_init (NULL, spin);
+}
+
 # define vlc_spin_lock    vlc_mutex_lock
 # define vlc_spin_unlock  vlc_mutex_unlock
 # define vlc_spin_destroy vlc_mutex_destroy