]> git.sesse.net Git - vlc/blobdiff - include/vlc_threads.h
Use filter chain in video output core.
[vlc] / include / vlc_threads.h
index ec07c4cbcd0808cacf1bc1ee74739b1e053cdec4..3a04143799f837031a502b556b3c8644dd71eaef 100644 (file)
@@ -38,7 +38,7 @@
 #   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>
@@ -47,6 +47,7 @@
 #   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 */
@@ -133,7 +134,7 @@ typedef struct
 
 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 */
@@ -170,7 +171,8 @@ VLC_EXPORT( int,  vlc_mutex_init_recursive, ( vlc_mutex_t * ) );
 VLC_EXPORT( void,  __vlc_mutex_destroy, ( const char *, int, vlc_mutex_t * ) );
 VLC_EXPORT( int,  __vlc_cond_init,     ( vlc_cond_t * ) );
 VLC_EXPORT( void,  __vlc_cond_destroy,  ( const char *, int, vlc_cond_t * ) );
-VLC_EXPORT( int, __vlc_threadvar_create, (vlc_threadvar_t * ) );
+VLC_EXPORT( int, vlc_threadvar_create, (vlc_threadvar_t * , void (*) (void *) ) );
+VLC_EXPORT( void, vlc_threadvar_delete, (vlc_threadvar_t *) );
 VLC_EXPORT( int,  __vlc_thread_create, ( vlc_object_t *, const char *, int, const char *, void * ( * ) ( void * ), int, bool ) );
 VLC_EXPORT( int,  __vlc_thread_set_priority, ( vlc_object_t *, const char *, int, int ) );
 VLC_EXPORT( void, __vlc_thread_ready,  ( vlc_object_t * ) );
@@ -182,9 +184,9 @@ VLC_EXPORT( void, __vlc_thread_join,   ( vlc_object_t *, const char *, int ) );
 #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)
@@ -211,7 +213,7 @@ static inline void __vlc_mutex_lock( const char * psz_file, int i_line,
 
     WaitForSingleObject( *p_mutex, INFINITE );
 
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
     acquire_sem( p_mutex->lock );
 
 #endif
@@ -235,7 +237,7 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
     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 );
 
@@ -244,7 +246,7 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
 
     ReleaseMutex( *p_mutex );
 
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
     release_sem( p_mutex->lock );
 
 #endif
@@ -286,7 +288,7 @@ static inline void __vlc_cond_signal( const char * psz_file, int i_line,
      * 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;
@@ -344,7 +346,7 @@ static inline void __vlc_cond_wait( const char * psz_file, int i_line,
     /* 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 */
@@ -419,7 +421,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
 
     (void)psz_file; (void)i_line;
 
-#elif defined( HAVE_KERNEL_SCHEDULER_H )
+#elif defined( SYS_BEOS )
 #   error Unimplemented
 
 #endif
@@ -433,12 +435,6 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
 #define vlc_cond_destroy( P_COND )                                          \
     __vlc_cond_destroy( __FILE__, __LINE__, P_COND )
 
-/*****************************************************************************
- * vlc_threadvar_create: create a thread-local variable
- *****************************************************************************/
-#define vlc_threadvar_create( PTHIS, P_TLS )                                 \
-   __vlc_threadvar_create( P_TLS )
-
 /*****************************************************************************
  * vlc_threadvar_set: create: set the value of a thread-local variable
  *****************************************************************************/
@@ -449,7 +445,7 @@ static inline int vlc_threadvar_set( vlc_threadvar_t * p_tls, void *p_value )
 #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 )
@@ -470,7 +466,7 @@ static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
 #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 )