diff options
-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 (); |