]> git.sesse.net Git - vlc/blobdiff - include/vlc_threads.h
* include/vlc_keys.h: added StringToKey()
[vlc] / include / vlc_threads.h
index 4b05a28b03383e5566cc2206d3e3de64c5596cf8..3b6c9d7abfcf369b3a98e559c5dff7180be3d1eb 100644 (file)
@@ -3,7 +3,7 @@
  * This header provides portable declarations for mutexes & conditions
  *****************************************************************************
  * Copyright (C) 1999, 2002 VideoLAN
- * $Id: vlc_threads.h,v 1.11 2002/08/30 12:23:23 sam Exp $
+ * $Id: vlc_threads.h,v 1.35 2003/11/07 19:30:28 massiot Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -27,7 +27,7 @@
 
 #include <stdio.h>
 
-#if defined(GPROF) || defined(DEBUG)
+#if defined(DEBUG) && defined(HAVE_SYS_TIME_H)
 #   include <sys/time.h>
 #endif
 
 #elif defined( ST_INIT_IN_ST_H )                            /* State threads */
 #   include <st.h>
 
-#elif defined( WIN32 )                                          /* Win32 API */
-#   include <process.h>
+#elif defined( UNDER_CE )
+                                                                /* WinCE API */
+#elif defined( WIN32 )
+#   include <process.h>                                         /* Win32 API */
 
 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )  /* pthreads (like Linux & BSD) */
 #   include <pthread.h>
 
 /* Thread priorities */
 #ifdef SYS_DARWIN
-#   define VLC_THREAD_PRIORITY_LOW 10
+#   define VLC_THREAD_PRIORITY_LOW (-47)
 #   define VLC_THREAD_PRIORITY_INPUT 37
-#   define VLC_THREAD_PRIORITY_AUDIO 38
-#   define VLC_THREAD_PRIORITY_OUTPUT 38
+#   define VLC_THREAD_PRIORITY_AUDIO 37
+#   define VLC_THREAD_PRIORITY_VIDEO (-47)
+#   define VLC_THREAD_PRIORITY_OUTPUT 37
+
+#elif defined(PTHREAD_COND_T_IN_PTHREAD_H)
+#   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
 
-#elif defined(WIN32)
+#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 THREAD_PRIORITY_ABOVE_NORMAL
-#   define VLC_THREAD_PRIORITY_AUDIO THREAD_PRIORITY_ABOVE_NORMAL
-#   define VLC_THREAD_PRIORITY_OUTPUT THREAD_PRIORITY_ABOVE_NORMAL
+#   define VLC_THREAD_PRIORITY_INPUT \
+        (IS_WINNT ? THREAD_PRIORITY_TIME_CRITICAL : 0)
+#   define VLC_THREAD_PRIORITY_AUDIO \
+        (IS_WINNT ? THREAD_PRIORITY_HIGHEST : 0)
+#   define VLC_THREAD_PRIORITY_VIDEO \
+        (IS_WINNT ? 0 : THREAD_PRIORITY_BELOW_NORMAL )
+#   define VLC_THREAD_PRIORITY_OUTPUT \
+        (IS_WINNT ? THREAD_PRIORITY_ABOVE_NORMAL : 0)
+#   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
 
 #endif
@@ -117,7 +143,7 @@ typedef struct
     vlc_object_t * p_this;
 } vlc_cond_t;
 
-#elif defined( WIN32 )
+#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 *);
@@ -194,7 +220,7 @@ typedef thread_id vlc_thread_t;
 
 typedef struct
 {
-    int32           init;
+    int32_t         init;
     sem_id          lock;
 
     vlc_object_t * p_this;
@@ -202,7 +228,7 @@ typedef struct
 
 typedef struct
 {
-    int32           init;
+    int32_t         init;
     thread_id       thread;
 
     vlc_object_t * p_this;