src/thread/windows/SDL_sysmutex.c
changeset 5336 66d3c4a6d6f8
parent 5335 2bb1233924f1
child 5535 96594ac5fd1a
--- a/src/thread/windows/SDL_sysmutex.c	Thu Feb 17 09:13:12 2011 -0800
+++ b/src/thread/windows/SDL_sysmutex.c	Thu Feb 17 09:26:15 2011 -0800
@@ -38,29 +38,17 @@
 SDL_CreateMutex(void)
 {
     SDL_mutex *mutex;
-    static DWORD (WINAPI*pf_SetCriticalSectionSpinCount)(LPCRITICAL_SECTION, DWORD) = NULL;
-    static HMODULE kernel32 = NULL;
-
-    /* One time logic - detect WinNT */
-    if(kernel32 == NULL) {
-        kernel32 = GetModuleHandleA("kernel32.dll");
-		if(kernel32) {
-            /* Attempt to resolve symbol -- Win9x gets NULL */
-            pf_SetCriticalSectionSpinCount = (DWORD (WINAPI*)(LPCRITICAL_SECTION, DWORD))GetProcAddress(kernel32, "SetCriticalSectionSpinCount");
-        }
-		else
-			kernel32 = (HMODULE)0x01; /* don't try to init again */
-	}
-
 
     /* Allocate mutex memory */
     mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
     if (mutex) {
         /* Initialize */
+#ifdef _WIN32_WCE
         InitializeCriticalSection(&mutex->cs);
-
+#else
         /* On SMP systems, a non-zero spin count generally helps performance */
-        if(pf_SetCriticalSectionSpinCount) pf_SetCriticalSectionSpinCount(&mutex->cs, 2000);
+        InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
+#endif
     } else {
         SDL_OutOfMemory();
     }