fic: Support rendering cursors
[ffmpeg.git] / compat / w32pthreads.h
index f570801..be275ed 100644 (file)
@@ -61,11 +61,18 @@ typedef struct pthread_cond_t {
 } pthread_cond_t;
 
 /* function pointers to conditional variable API on windows 6.0+ kernels */
 } pthread_cond_t;
 
 /* function pointers to conditional variable API on windows 6.0+ kernels */
+#if _WIN32_WINNT < 0x0600
 static void (WINAPI *cond_broadcast)(pthread_cond_t *cond);
 static void (WINAPI *cond_init)(pthread_cond_t *cond);
 static void (WINAPI *cond_signal)(pthread_cond_t *cond);
 static BOOL (WINAPI *cond_wait)(pthread_cond_t *cond, pthread_mutex_t *mutex,
                                 DWORD milliseconds);
 static void (WINAPI *cond_broadcast)(pthread_cond_t *cond);
 static void (WINAPI *cond_init)(pthread_cond_t *cond);
 static void (WINAPI *cond_signal)(pthread_cond_t *cond);
 static BOOL (WINAPI *cond_wait)(pthread_cond_t *cond, pthread_mutex_t *mutex,
                                 DWORD milliseconds);
+#else
+#define cond_init      InitializeConditionVariable
+#define cond_broadcast WakeAllConditionVariable
+#define cond_signal    WakeConditionVariable
+#define cond_wait      SleepConditionVariableCS
+#endif
 
 static unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
 {
 
 static unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
 {
@@ -129,7 +136,7 @@ typedef struct  win32_cond_t {
 static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
 {
     win32_cond_t *win32_cond = NULL;
 static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr)
 {
     win32_cond_t *win32_cond = NULL;
-    if (_WIN32_WINNT >= 0x0600 || cond_init) {
+    if (cond_init) {
         cond_init(cond);
         return;
     }
         cond_init(cond);
         return;
     }
@@ -154,7 +161,7 @@ static void pthread_cond_destroy(pthread_cond_t *cond)
 {
     win32_cond_t *win32_cond = cond->ptr;
     /* native condition variables do not destroy */
 {
     win32_cond_t *win32_cond = cond->ptr;
     /* native condition variables do not destroy */
-    if (_WIN32_WINNT >= 0x0600 || cond_init)
+    if (cond_init)
         return;
 
     /* non native condition variables */
         return;
 
     /* non native condition variables */
@@ -171,7 +178,7 @@ static void pthread_cond_broadcast(pthread_cond_t *cond)
     win32_cond_t *win32_cond = cond->ptr;
     int have_waiter;
 
     win32_cond_t *win32_cond = cond->ptr;
     int have_waiter;
 
-    if (_WIN32_WINNT >= 0x0600 || cond_broadcast) {
+    if (cond_broadcast) {
         cond_broadcast(cond);
         return;
     }
         cond_broadcast(cond);
         return;
     }
@@ -201,7 +208,7 @@ static int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
 {
     win32_cond_t *win32_cond = cond->ptr;
     int last_waiter;
 {
     win32_cond_t *win32_cond = cond->ptr;
     int last_waiter;
-    if (_WIN32_WINNT >= 0x0600 || cond_wait) {
+    if (cond_wait) {
         cond_wait(cond, mutex, INFINITE);
         return 0;
     }
         cond_wait(cond, mutex, INFINITE);
         return 0;
     }
@@ -233,7 +240,7 @@ static void pthread_cond_signal(pthread_cond_t *cond)
 {
     win32_cond_t *win32_cond = cond->ptr;
     int have_waiter;
 {
     win32_cond_t *win32_cond = cond->ptr;
     int have_waiter;
-    if (_WIN32_WINNT >= 0x0600 || cond_signal) {
+    if (cond_signal) {
         cond_signal(cond);
         return;
     }
         cond_signal(cond);
         return;
     }
@@ -267,11 +274,6 @@ static void w32thread_init(void)
         (void*)GetProcAddress(kernel_dll, "WakeConditionVariable");
     cond_wait      =
         (void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS");
         (void*)GetProcAddress(kernel_dll, "WakeConditionVariable");
     cond_wait      =
         (void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS");
-#else
-    cond_init      = InitializeConditionVariable;
-    cond_broadcast = WakeAllConditionVariable;
-    cond_signal    = WakeConditionVariable;
-    cond_wait      = SleepConditionVariableCS;
 #endif
 
 }
 #endif
 
 }