diff options
author | Simon Howard | 2008-02-09 22:21:33 +0000 |
---|---|---|
committer | Simon Howard | 2008-02-09 22:21:33 +0000 |
commit | 7577bb4156c0a75528a2901cf086c9c547467484 (patch) | |
tree | a2e4fb4762e5648a5cc758f8d79ded5da1e8b4de | |
parent | aadc860d70492ca5d966864a0b6fb3f49dbc4001 (diff) | |
download | chocolate-doom-7577bb4156c0a75528a2901cf086c9c547467484.tar.gz chocolate-doom-7577bb4156c0a75528a2901cf086c9c547467484.tar.bz2 chocolate-doom-7577bb4156c0a75528a2901cf086c9c547467484.zip |
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
-rw-r--r-- | src/i_main.c | 17 |
1 files changed, 17 insertions, 0 deletions
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 <signal.h> +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#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 (); |