-From 428961aaa351425bc15011df633faba8d3ff246b Mon Sep 17 00:00:00 2001
+From 9a7bab675cb8d8609f507d323d7744e70bba6826 Mon Sep 17 00:00:00 2001
 From: Martin Herkt <lachs0r@srsfckn.biz>
-Date: Sat, 7 Sep 2013 22:48:18 +0200
+Date: Sat, 16 Nov 2013 15:52:29 +0100
 Subject: [PATCH] Require pthreads on Windows too
 
 ---
- Alc/helpers.c             | 44 ++++----------------------------------------
- CMakeLists.txt            | 45 ++++++++++++++++++++++-----------------------
- OpenAL32/Include/alMain.h | 15 +--------------
- 3 files changed, 27 insertions(+), 77 deletions(-)
+ Alc/compat.h   | 17 ++---------------
+ Alc/helpers.c  | 45 +++++----------------------------------------
+ CMakeLists.txt | 53 ++++++++++++++++++++++++++---------------------------
+ 3 files changed, 33 insertions(+), 82 deletions(-)
 
+diff --git a/Alc/compat.h b/Alc/compat.h
+index af9f8e8..fa29714 100644
+--- a/Alc/compat.h
++++ b/Alc/compat.h
+@@ -3,32 +3,19 @@
+ 
+ #include "AL/al.h"
+ 
++#include <pthread.h>
++
+ #ifdef _WIN32
+ 
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+ 
+-typedef DWORD pthread_key_t;
+-int pthread_key_create(pthread_key_t *key, void (*callback)(void*));
+-int pthread_key_delete(pthread_key_t key);
+-void *pthread_getspecific(pthread_key_t key);
+-int pthread_setspecific(pthread_key_t key, void *val);
+-
+ WCHAR *strdupW(const WCHAR *str);
+ 
+-typedef LONG pthread_once_t;
+-#define PTHREAD_ONCE_INIT 0
+-void pthread_once(pthread_once_t *once, void (*callback)(void));
+-
+-static inline int sched_yield(void)
+-{ SwitchToThread(); return 0; }
+-
+ #define HAVE_DYNLOAD 1
+ 
+ #else
+ 
+-#include <pthread.h>
+-
+ typedef pthread_mutex_t CRITICAL_SECTION;
+ void InitializeCriticalSection(CRITICAL_SECTION *cs);
+ void DeleteCriticalSection(CRITICAL_SECTION *cs);
 diff --git a/Alc/helpers.c b/Alc/helpers.c
-index fe1318c..6d65354 100644
+index 6c6c88e..d2fc83b 100644
 --- a/Alc/helpers.c
 +++ b/Alc/helpers.c
-@@ -265,44 +265,12 @@ void RestoreFPUMode(const FPUCtl *ctl)
- #endif
+@@ -290,43 +290,12 @@ void RestoreFPUMode(const FPUCtl *ctl)
  }
  
-+#include <pthread.h>
-+#ifdef HAVE_PTHREAD_NP_H
-+#include <pthread_np.h>
-+#endif
  
- #ifdef _WIN32
+-#ifdef _WIN32
 -void pthread_once(pthread_once_t *once, void (*callback)(void))
 -{
 -    LONG ret;

-    return 0;
-}
-
-
 void *LoadLib(const char *name)
 { return LoadLibraryA(name); }
 void CloseLib(void *handle)
@@ -335,10 +303,6 @@ WCHAR *strdupW(const WCHAR *str)
 
 #else
 

-    # Some systems need pthread_np.h to get recursive mutexes
-    CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
-
-    CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
-    IF(HAVE_PTHREAD)
-        ADD_DEFINITIONS(-pthread)
-        SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread")
-        SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
-    ENDIF()
-
-    CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
-    IF(HAVE_LIBPTHREAD)
-        SET(EXTRA_LIBS pthread ${EXTRA_LIBS})
-    ENDIF()
-
-    CHECK_SYMBOL_EXISTS(pthread_setschedparam pthread.h HAVE_PTHREAD_SETSCHEDPARAM)
-
-    CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
-    IF(NOT HAVE_PTHREAD_SETNAME_NP)
-        CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
-    ENDIF()
-
     CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT)
     IF(HAVE_LIBRT)
         SET(EXTRA_LIBS rt ${EXTRA_LIBS})
-- 
1.8.0.1

