src/thread/windows/SDL_sysmutex.c
changeset 5336 66d3c4a6d6f8
parent 5335 2bb1233924f1
child 5535 96594ac5fd1a
     1.1 --- a/src/thread/windows/SDL_sysmutex.c	Thu Feb 17 09:13:12 2011 -0800
     1.2 +++ b/src/thread/windows/SDL_sysmutex.c	Thu Feb 17 09:26:15 2011 -0800
     1.3 @@ -38,29 +38,17 @@
     1.4  SDL_CreateMutex(void)
     1.5  {
     1.6      SDL_mutex *mutex;
     1.7 -    static DWORD (WINAPI*pf_SetCriticalSectionSpinCount)(LPCRITICAL_SECTION, DWORD) = NULL;
     1.8 -    static HMODULE kernel32 = NULL;
     1.9 -
    1.10 -    /* One time logic - detect WinNT */
    1.11 -    if(kernel32 == NULL) {
    1.12 -        kernel32 = GetModuleHandleA("kernel32.dll");
    1.13 -		if(kernel32) {
    1.14 -            /* Attempt to resolve symbol -- Win9x gets NULL */
    1.15 -            pf_SetCriticalSectionSpinCount = (DWORD (WINAPI*)(LPCRITICAL_SECTION, DWORD))GetProcAddress(kernel32, "SetCriticalSectionSpinCount");
    1.16 -        }
    1.17 -		else
    1.18 -			kernel32 = (HMODULE)0x01; /* don't try to init again */
    1.19 -	}
    1.20 -
    1.21  
    1.22      /* Allocate mutex memory */
    1.23      mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
    1.24      if (mutex) {
    1.25          /* Initialize */
    1.26 +#ifdef _WIN32_WCE
    1.27          InitializeCriticalSection(&mutex->cs);
    1.28 -
    1.29 +#else
    1.30          /* On SMP systems, a non-zero spin count generally helps performance */
    1.31 -        if(pf_SetCriticalSectionSpinCount) pf_SetCriticalSectionSpinCount(&mutex->cs, 2000);
    1.32 +        InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
    1.33 +#endif
    1.34      } else {
    1.35          SDL_OutOfMemory();
    1.36      }