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>
This commit is contained in:
Jon TURNEY 2012-11-13 13:22:44 +00:00
parent b20d2998cd
commit fb170498ab
2 changed files with 13 additions and 0 deletions

View File

@ -223,7 +223,11 @@ UpdateCurrentTimeIf(void)
#define SMART_SCHEDULE_DEFAULT_INTERVAL 20 /* ms */
#define SMART_SCHEDULE_MAX_SLICE 200 /* ms */
#if defined(WIN32) && !defined(__CYGWIN__)
Bool SmartScheduleDisable = TRUE;
#else
Bool SmartScheduleDisable = FALSE;
#endif
long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL;
long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE;

View File

@ -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