* 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_
# include <process.h> /* Win32 API */
# include <errno.h>
-#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* BeOS */
+#elif defined( SYS_BEOS ) /* BeOS */
# include <kernel/OS.h>
# include <kernel/scheduler.h>
# include <byteorder.h>
# define LIBVLC_USE_PTHREAD 1
# define _APPLE_C_SOURCE 1 /* Proper pthread semantics on OSX */
+# include <stdlib.h> /* lldiv_t definition (only in C99) */
# include <unistd.h> /* _POSIX_SPIN_LOCKS */
# include <pthread.h>
/* Needed for pthread_cond_timedwait */
/* 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 */
typedef DWORD vlc_threadvar_t;
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
/* This is the BeOS implementation of the vlc threads, note that the mutex is
* not a real mutex and the cond_var is not like a pthread cond_var but it is
* enough for what we need */
#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)
WaitForSingleObject( *p_mutex, INFINITE );
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
acquire_sem( p_mutex->lock );
#endif
VLC_THREAD_ASSERT ("unlocking mutex");
#elif defined( UNDER_CE )
- (void)psz_file); (void)i_line;
+ (void)psz_file; (void)i_line;
LeaveCriticalSection( &p_mutex->csection );
ReleaseMutex( *p_mutex );
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
release_sem( p_mutex->lock );
#endif
* as documented in http://support.microsoft.com/kb/q173260/ */
PulseEvent( p_condvar->event );
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
while( p_condvar->thread != -1 )
{
thread_info info;
/* Reacquire the mutex before returning. */
vlc_mutex_lock( p_mutex );
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
/* The p_condvar->thread var is initialized before the unlock because
* it enables to identify when the thread is interrupted beetwen the
* unlock line and the suspend_thread line */
(void)psz_file; (void)i_line;
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
# error Unimplemented
#endif
#if defined(LIBVLC_USE_PTHREAD)
i_ret = pthread_setspecific( *p_tls, p_value );
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
i_ret = EINVAL;
#elif defined( UNDER_CE ) || defined( WIN32 )
#if defined(LIBVLC_USE_PTHREAD)
p_ret = pthread_getspecific( *p_tls );
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
p_ret = NULL;
#elif defined( UNDER_CE ) || defined( WIN32 )