From 7577bb4156c0a75528a2901cf086c9c547467484 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 9 Feb 2008 22:21:33 +0000 Subject: Set the process affinity mask to 1 on Windows, to work around a bug in SDL_mixer (thanks entryway). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1068 --- src/i_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/i_main.c b/src/i_main.c index da6c5474..b95ecf40 100644 --- a/src/i_main.c +++ b/src/i_main.c @@ -29,6 +29,11 @@ #include +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#endif + #include "doomdef.h" #include "i_system.h" #include "m_argv.h" @@ -41,6 +46,18 @@ int main(int argc, char **argv) myargc = argc; myargv = argv; +#ifdef _WIN32 + // Set the process affinity mask to 1 on Windows, so that all threads + // run on the same processor. This is a workaround for a bug in + // SDL_mixer that causes occasional crashes. + + if (!SetProcessAffinityMask(GetCurrentProcess(), 1)) + { + fprintf(stderr, "Failed to set process affinity mask (%d)\n", + GetLastError()); + } +#endif + // start doom D_DoomMain (); -- cgit v1.2.3