* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#if !defined( __LIBVLC__ )
- #error You are not libvlc or one of its plugins. You cannot include this file
-#endif
-
#ifndef _VLC_THREADS_H_
#define _VLC_THREADS_H_
/* Thread priorities */
#ifdef __APPLE__
-# define VLC_THREAD_PRIORITY_LOW (-47)
-# define VLC_THREAD_PRIORITY_INPUT 37
-# define VLC_THREAD_PRIORITY_AUDIO 37
-# define VLC_THREAD_PRIORITY_VIDEO (-47)
-# define VLC_THREAD_PRIORITY_OUTPUT 37
-# define VLC_THREAD_PRIORITY_HIGHEST 37
+# define VLC_THREAD_PRIORITY_LOW 0
+# define VLC_THREAD_PRIORITY_INPUT 22
+# define VLC_THREAD_PRIORITY_AUDIO 22
+# define VLC_THREAD_PRIORITY_VIDEO 0
+# define VLC_THREAD_PRIORITY_OUTPUT 22
+# define VLC_THREAD_PRIORITY_HIGHEST 22
#elif defined(SYS_BEOS)
# define VLC_THREAD_PRIORITY_LOW 5
# define VLC_THREAD_PRIORITY_HIGHEST 15
#elif defined(LIBVLC_USE_PTHREAD)
-# define VLC_THREAD_PRIORITY_LOW 0
-# define VLC_THREAD_PRIORITY_INPUT 20
-# define VLC_THREAD_PRIORITY_AUDIO 10
-# define VLC_THREAD_PRIORITY_VIDEO 0
-# define VLC_THREAD_PRIORITY_OUTPUT 30
-# define VLC_THREAD_PRIORITY_HIGHEST 40
+# define VLC_THREAD_PRIORITY_LOW 0
+# define VLC_THREAD_PRIORITY_INPUT 10
+# define VLC_THREAD_PRIORITY_AUDIO 5
+# define VLC_THREAD_PRIORITY_VIDEO 0
+# define VLC_THREAD_PRIORITY_OUTPUT 15
+# define VLC_THREAD_PRIORITY_HIGHEST 20
#elif defined(WIN32) || defined(UNDER_CE)
/* Define different priorities for WinNT/2K/XP and Win9x/Me */
#define vlc_mutex_lock( P_MUTEX ) \
__vlc_mutex_lock( __FILE__, __LINE__, P_MUTEX )
-#if defined(LIBVLC_USE_PTHREAD)
VLC_EXPORT(void, vlc_pthread_fatal, (const char *action, int error, const char *file, unsigned line));
+#if defined(LIBVLC_USE_PTHREAD)
# define VLC_THREAD_ASSERT( action ) \
if (val) \
vlc_pthread_fatal (action, val, psz_file, i_line)
# define vlc_spin_destroy vlc_mutex_destroy
#endif
+/**
+ * Issues a full memory barrier.
+ */
+static inline void barrier (void)
+{
+#if defined (__GNUC__) /* FIXME: || defined (ICC_whatever) */
+ __sync_synchronize ();
+#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!
+#endif
+}
+
/*****************************************************************************
* vlc_thread_create: create a thread
*****************************************************************************/