summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i_main.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/i_main.c b/src/i_main.c
index 7c5b16e7..3a9ec696 100644
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -29,18 +29,6 @@
#include "SDL.h"
-#include <signal.h>
-
-#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#endif
-
-#ifdef HAVE_SCHED_SETAFFINITY
-#include <unistd.h>
-#include <sched.h>
-#endif
-
#include "doomdef.h"
#include "i_system.h"
#include "m_argv.h"
@@ -48,6 +36,9 @@
#if defined(_WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
typedef BOOL WINAPI (*SetAffinityFunc)(HANDLE hProcess, DWORD_PTR mask);
// This is a bit more complicated than it really needs to be. We really
@@ -93,16 +84,24 @@ static void LockCPUAffinity(void)
#elif defined(HAVE_SCHED_SETAFFINITY)
+#include <unistd.h>
+#include <sched.h>
+
// Unix (Linux) version:
static void LockCPUAffinity(void)
{
+#ifdef CPU_SET
cpu_set_t set;
CPU_ZERO(&set);
CPU_SET(0, &set);
sched_setaffinity(getpid(), sizeof(set), &set);
+#else
+ unsigned long mask = 1;
+ sched_setaffinity(getpid(), sizeof(mask), &mask);
+#endif
}
#else