X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_threads.h;h=9627fc1fc01bd8b22abd8cfebe2bc847cd6127c0;hb=abecc78ae9e26deedc62e34364b8ebcafcea0fdd;hp=3b6c9d7abfcf369b3a98e559c5dff7180be3d1eb;hpb=5cefc0731165d7e6ed58942d422136f3126c6842;p=vlc diff --git a/include/vlc_threads.h b/include/vlc_threads.h index 3b6c9d7abf..9627fc1fc0 100644 --- a/include/vlc_threads.h +++ b/include/vlc_threads.h @@ -2,8 +2,8 @@ * vlc_threads.h : threads implementation for the VideoLAN client * This header provides portable declarations for mutexes & conditions ***************************************************************************** - * Copyright (C) 1999, 2002 VideoLAN - * $Id: vlc_threads.h,v 1.35 2003/11/07 19:30:28 massiot Exp $ + * Copyright (C) 1999, 2002 the VideoLAN team + * $Id$ * * Authors: Jean-Marc Dressler * Samuel Hocevar @@ -14,7 +14,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -22,7 +22,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #include @@ -42,7 +42,14 @@ #elif defined( WIN32 ) # include /* Win32 API */ +#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* BeOS */ +# include +# include +# include + #elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) /* pthreads (like Linux & BSD) */ +# define LIBVLC_USE_PTHREAD 1 + # include # ifdef DEBUG /* Needed for pthread_cond_timedwait */ @@ -54,11 +61,6 @@ #elif defined( HAVE_CTHREADS_H ) /* GNUMach */ # include -#elif defined( HAVE_KERNEL_SCHEDULER_H ) /* BeOS */ -# include -# include -# include - #else # error no threads available on your system ! @@ -69,12 +71,21 @@ *****************************************************************************/ /* Thread priorities */ -#ifdef SYS_DARWIN +#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 + +#elif defined(SYS_BEOS) +# define VLC_THREAD_PRIORITY_LOW 5 +# define VLC_THREAD_PRIORITY_INPUT 10 +# define VLC_THREAD_PRIORITY_AUDIO 10 +# define VLC_THREAD_PRIORITY_VIDEO 5 +# define VLC_THREAD_PRIORITY_OUTPUT 15 +# define VLC_THREAD_PRIORITY_HIGHEST 15 #elif defined(PTHREAD_COND_T_IN_PTHREAD_H) # define VLC_THREAD_PRIORITY_LOW 0 @@ -82,12 +93,13 @@ # define VLC_THREAD_PRIORITY_AUDIO 10 # define VLC_THREAD_PRIORITY_VIDEO 0 # define VLC_THREAD_PRIORITY_OUTPUT 30 +# define VLC_THREAD_PRIORITY_HIGHEST 40 #elif defined(WIN32) || defined(UNDER_CE) /* Define different priorities for WinNT/2K/XP and Win9x/Me */ # define VLC_THREAD_PRIORITY_LOW 0 # define VLC_THREAD_PRIORITY_INPUT \ - (IS_WINNT ? THREAD_PRIORITY_TIME_CRITICAL : 0) + (IS_WINNT ? THREAD_PRIORITY_ABOVE_NORMAL : 0) # define VLC_THREAD_PRIORITY_AUDIO \ (IS_WINNT ? THREAD_PRIORITY_HIGHEST : 0) # define VLC_THREAD_PRIORITY_VIDEO \ @@ -97,19 +109,13 @@ # define VLC_THREAD_PRIORITY_HIGHEST \ (IS_WINNT ? THREAD_PRIORITY_TIME_CRITICAL : 0) -#elif defined(SYS_BEOS) -# define VLC_THREAD_PRIORITY_LOW 5 -# define VLC_THREAD_PRIORITY_INPUT 10 -# define VLC_THREAD_PRIORITY_AUDIO 10 -# define VLC_THREAD_PRIORITY_VIDEO 5 -# define VLC_THREAD_PRIORITY_OUTPUT 15 - #else # define VLC_THREAD_PRIORITY_LOW 0 # define VLC_THREAD_PRIORITY_INPUT 0 # define VLC_THREAD_PRIORITY_AUDIO 0 # define VLC_THREAD_PRIORITY_VIDEO 0 # define VLC_THREAD_PRIORITY_OUTPUT 0 +# define VLC_THREAD_PRIORITY_HIGHEST 0 #endif @@ -146,7 +152,7 @@ typedef struct #elif defined( WIN32 ) || defined( UNDER_CE ) typedef HANDLE vlc_thread_t; typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT) ( HANDLE, HANDLE, DWORD, BOOL ); -typedef unsigned (__stdcall *PTHREAD_START) (void *); +typedef unsigned (WINAPI *PTHREAD_START) (void *); typedef struct { @@ -172,6 +178,29 @@ typedef struct vlc_object_t * p_this; } vlc_cond_t; +#elif defined( HAVE_KERNEL_SCHEDULER_H ) +/* 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 wee need */ + +typedef thread_id vlc_thread_t; + +typedef struct +{ + int32_t init; + sem_id lock; + + vlc_object_t * p_this; +} vlc_mutex_t; + +typedef struct +{ + int32_t init; + thread_id thread; + + vlc_object_t * p_this; +} vlc_cond_t; + #elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) typedef pthread_t vlc_thread_t; typedef struct @@ -211,28 +240,5 @@ typedef struct vlc_object_t * p_this; } vlc_cond_t; -#elif defined( HAVE_KERNEL_SCHEDULER_H ) -/* 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 wee need */ - -typedef thread_id vlc_thread_t; - -typedef struct -{ - int32_t init; - sem_id lock; - - vlc_object_t * p_this; -} vlc_mutex_t; - -typedef struct -{ - int32_t init; - thread_id thread; - - vlc_object_t * p_this; -} vlc_cond_t; - #endif