summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-11-13 13:22:44 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-28 14:44:12 +0000
commitfb170498abc746a850864b59db2ddcba7ee29215 (patch)
tree596e55fd27b8d3020e6e4c919a93dcb426f41dd1 /os
parentb20d2998cd9a1320ef0e45ab6b741c7e25f646e0 (diff)
dix/dispatch.c, os/utils.c: Disable smart scheduler on WIN32
setitimer() and SIGALRM aren't available on WIN32, so smart scheduler code cannot be built. Provide only stubs for smart scheduler timer code, and disable smart scheduler by default. Signed-off-by: Ryan Pavlik <rpavlik@iastate.edu> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk> Tested-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net> Reviewed-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'os')
-rw-r--r--os/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/os/utils.c b/os/utils.c
index 411daa047..6f75c1704 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -71,6 +71,7 @@ __stdcall unsigned long GetTickCount(void);
#if !defined(WIN32) || !defined(__MINGW32__)
#include <sys/time.h>
#include <sys/resource.h>
+# define SMART_SCHEDULE_POSSIBLE
#endif
#include "misc.h"
#include <X11/X.h>
@@ -898,6 +899,7 @@ ProcessCommandLine(int argc, char *argv[])
i = skip - 1;
}
#endif
+#ifdef SMART_SCHEDULE_POSSIBLE
else if (strcmp(argv[i], "-dumbSched") == 0) {
SmartScheduleDisable = TRUE;
}
@@ -916,6 +918,7 @@ ProcessCommandLine(int argc, char *argv[])
else
UseMsg();
}
+#endif
else if (strcmp(argv[i], "-render") == 0) {
if (++i < argc) {
int policy = PictureParseCmapPolicy(argv[i]);
@@ -1127,6 +1130,7 @@ XNFstrdup(const char *s)
void
SmartScheduleStopTimer(void)
{
+#ifdef SMART_SCHEDULE_POSSIBLE
struct itimerval timer;
if (SmartScheduleDisable)
@@ -1136,11 +1140,13 @@ SmartScheduleStopTimer(void)
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = 0;
(void) setitimer(ITIMER_REAL, &timer, 0);
+#endif
}
void
SmartScheduleStartTimer(void)
{
+#ifdef SMART_SCHEDULE_POSSIBLE
struct itimerval timer;
if (SmartScheduleDisable)
@@ -1150,6 +1156,7 @@ SmartScheduleStartTimer(void)
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = SmartScheduleInterval * 1000;
setitimer(ITIMER_REAL, &timer, 0);
+#endif
}
static void
@@ -1161,6 +1168,7 @@ SmartScheduleTimer(int sig)
void
SmartScheduleInit(void)
{
+#ifdef SMART_SCHEDULE_POSSIBLE
struct sigaction act;
if (SmartScheduleDisable)
@@ -1176,6 +1184,7 @@ SmartScheduleInit(void)
perror("sigaction for smart scheduler");
SmartScheduleDisable = TRUE;
}
+#endif
}
#ifdef SIG_BLOCK