summaryrefslogtreecommitdiff
path: root/src/i_main.c
diff options
context:
space:
mode:
authorSimon Howard2008-09-23 23:12:03 +0000
committerSimon Howard2008-09-23 23:12:03 +0000
commitfb176d6121a9313cd98cd015045d239ddfef3994 (patch)
treeca696ac4195e62bc46ba88c8500fd16eb87e1594 /src/i_main.c
parent350fe185784d6d0350ed8b675630440ff425a6ca (diff)
parent5bab2a788da04bd8aaa65891cb3fc7240d56a9b7 (diff)
downloadchocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.tar.gz
chocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.tar.bz2
chocolate-doom-fb176d6121a9313cd98cd015045d239ddfef3994.zip
Merge updates from trunk.
Subversion-branch: /branches/raven-branch Subversion-revision: 1266
Diffstat (limited to 'src/i_main.c')
-rw-r--r--src/i_main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/i_main.c b/src/i_main.c
index ac4a68e3..4efd2cd9 100644
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -32,6 +32,9 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#else
+#include <unistd.h>
+#include <sched.h>
#endif
#include "doomtype.h"
@@ -53,16 +56,27 @@ 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
+ // Set the process affinity mask so that all threads
// run on the same processor. This is a workaround for a bug in
// SDL_mixer that causes occasional crashes.
+#ifdef _WIN32
if (!SetProcessAffinityMask(GetCurrentProcess(), 1))
{
fprintf(stderr, "Failed to set process affinity mask (%d)\n",
(int) GetLastError());
}
+#else
+ // POSIX version:
+
+ {
+ cpu_set_t set;
+
+ CPU_ZERO(&set);
+ CPU_SET(0, &set);
+
+ sched_setaffinity(getpid(), sizeof(set), &set);
+ }
#endif
// start doom