summaryrefslogtreecommitdiff
path: root/src/i_main.c
diff options
context:
space:
mode:
authorSimon Howard2008-12-20 20:25:22 +0000
committerSimon Howard2008-12-20 20:25:22 +0000
commitb9b0c2abfbe194baf6d497f1c4a2165769f64ab3 (patch)
treea82b96f274bd7427b963964f37242607a27c593d /src/i_main.c
parent0ec9859ec8cf39ce1223516161fb39ea44ed5c33 (diff)
parentacd1a13a4f70973d7616df3f6de43f8f79b8e392 (diff)
downloadchocolate-doom-b9b0c2abfbe194baf6d497f1c4a2165769f64ab3.tar.gz
chocolate-doom-b9b0c2abfbe194baf6d497f1c4a2165769f64ab3.tar.bz2
chocolate-doom-b9b0c2abfbe194baf6d497f1c4a2165769f64ab3.zip
Merge from trunk.
Subversion-branch: /branches/raven-branch Subversion-revision: 1423
Diffstat (limited to 'src/i_main.c')
-rw-r--r--src/i_main.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/i_main.c b/src/i_main.c
index bab514dd..d7cdcef6 100644
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -25,6 +25,8 @@
//-----------------------------------------------------------------------------
+#include "config.h"
+
#include "SDL.h"
#include <signal.h>
@@ -32,7 +34,9 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
-#else
+#endif
+
+#ifdef HAVE_SCHED_SETAFFINITY
#include <unistd.h>
#include <sched.h>
#endif
@@ -49,25 +53,34 @@
void D_DoomMain (void);
-int main(int argc, char **argv)
-{
+#if !defined(_WIN32) && !defined(HAVE_SCHED_SETAFFINITY)
+#warning No known way to set processor affinity on this platform.
+#warning You may experience crashes due to SDL_mixer.
+#endif
+
+int main(int argc, char **argv)
+{
// save arguments
- myargc = argc;
- myargv = argv;
+ myargc = argc;
+ myargv = argv;
+
+#ifdef _WIN32
// Set the process affinity mask so that all threads
- // run on the same processor. This is a workaround for a bug in
+ // 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());
}
-#elif !defined(__APPLE__)
- // POSIX version:
+#endif
+
+#ifdef HAVE_SCHED_SETAFFINITY
+
+ // Linux version:
{
cpu_set_t set;
@@ -77,12 +90,13 @@ int main(int argc, char **argv)
sched_setaffinity(getpid(), sizeof(set), &set);
}
+
#endif
// start doom
-
- D_DoomMain ();
+
+ D_DoomMain ();
return 0;
-}
+}