Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Our minimum Windows version is Windows 2000, so it's okay to directly…
Browse files Browse the repository at this point in the history
… call InitializeCriticalSectionAndSpinCount()..
  • Loading branch information
slouken committed Feb 17, 2011
1 parent efe1af2 commit 93f73fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/core/windows/SDL_windows.h 100644 → 100755
Expand Up @@ -30,8 +30,8 @@
#ifndef UNICODE
#define UNICODE 1
#endif
#undef WINVER
#define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */

#include <windows.h>

Expand Down
20 changes: 4 additions & 16 deletions src/thread/windows/SDL_sysmutex.c 100644 → 100755
Expand Up @@ -38,29 +38,17 @@ SDL_mutex *
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();
}
Expand Down
7 changes: 0 additions & 7 deletions src/video/windows/SDL_windowsmouse.c 100644 → 100755
Expand Up @@ -20,13 +20,6 @@
slouken@libsdl.org
*/

/* we need to define it, so that raw input is included*/

#if (_WIN32_WINNT < 0x0501)
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif

#include "SDL_config.h"

#include "SDL_windowsvideo.h"
Expand Down

0 comments on commit 93f73fd

Please sign in to comment.