Our minimum Windows version is Windows 2000, so it's okay to directly call InitializeCriticalSectionAndSpinCount()..
authorSam Lantinga <slouken@libsdl.org>
Thu, 17 Feb 2011 09:26:15 -0800
changeset 533666d3c4a6d6f8
parent 5335 2bb1233924f1
child 5337 d5d312a82d40
Our minimum Windows version is Windows 2000, so it's okay to directly call InitializeCriticalSectionAndSpinCount()..
src/core/windows/SDL_windows.h
src/thread/windows/SDL_sysmutex.c
src/video/windows/SDL_windowsmouse.c
     1.1 --- a/src/core/windows/SDL_windows.h	Thu Feb 17 09:13:12 2011 -0800
     1.2 +++ b/src/core/windows/SDL_windows.h	Thu Feb 17 09:26:15 2011 -0800
     1.3 @@ -30,8 +30,8 @@
     1.4  #ifndef UNICODE
     1.5  #define UNICODE 1
     1.6  #endif
     1.7 -#undef WINVER
     1.8 -#define WINVER  0x500           /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
     1.9 +#undef _WIN32_WINNT
    1.10 +#define _WIN32_WINNT  0x500   /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
    1.11  
    1.12  #include <windows.h>
    1.13  
     2.1 --- a/src/thread/windows/SDL_sysmutex.c	Thu Feb 17 09:13:12 2011 -0800
     2.2 +++ b/src/thread/windows/SDL_sysmutex.c	Thu Feb 17 09:26:15 2011 -0800
     2.3 @@ -38,29 +38,17 @@
     2.4  SDL_CreateMutex(void)
     2.5  {
     2.6      SDL_mutex *mutex;
     2.7 -    static DWORD (WINAPI*pf_SetCriticalSectionSpinCount)(LPCRITICAL_SECTION, DWORD) = NULL;
     2.8 -    static HMODULE kernel32 = NULL;
     2.9 -
    2.10 -    /* One time logic - detect WinNT */
    2.11 -    if(kernel32 == NULL) {
    2.12 -        kernel32 = GetModuleHandleA("kernel32.dll");
    2.13 -		if(kernel32) {
    2.14 -            /* Attempt to resolve symbol -- Win9x gets NULL */
    2.15 -            pf_SetCriticalSectionSpinCount = (DWORD (WINAPI*)(LPCRITICAL_SECTION, DWORD))GetProcAddress(kernel32, "SetCriticalSectionSpinCount");
    2.16 -        }
    2.17 -		else
    2.18 -			kernel32 = (HMODULE)0x01; /* don't try to init again */
    2.19 -	}
    2.20 -
    2.21  
    2.22      /* Allocate mutex memory */
    2.23      mutex = (SDL_mutex *) SDL_malloc(sizeof(*mutex));
    2.24      if (mutex) {
    2.25          /* Initialize */
    2.26 +#ifdef _WIN32_WCE
    2.27          InitializeCriticalSection(&mutex->cs);
    2.28 -
    2.29 +#else
    2.30          /* On SMP systems, a non-zero spin count generally helps performance */
    2.31 -        if(pf_SetCriticalSectionSpinCount) pf_SetCriticalSectionSpinCount(&mutex->cs, 2000);
    2.32 +        InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000);
    2.33 +#endif
    2.34      } else {
    2.35          SDL_OutOfMemory();
    2.36      }
     3.1 --- a/src/video/windows/SDL_windowsmouse.c	Thu Feb 17 09:13:12 2011 -0800
     3.2 +++ b/src/video/windows/SDL_windowsmouse.c	Thu Feb 17 09:26:15 2011 -0800
     3.3 @@ -20,13 +20,6 @@
     3.4      slouken@libsdl.org
     3.5  */
     3.6  
     3.7 -/* we need to define it, so that raw input is included*/
     3.8 -
     3.9 -#if (_WIN32_WINNT < 0x0501)
    3.10 -#undef _WIN32_WINNT
    3.11 -#define _WIN32_WINNT 0x0501
    3.12 -#endif
    3.13 -
    3.14  #include "SDL_config.h"
    3.15  
    3.16  #include "SDL_windowsvideo.h"