From e10ba9e4b52269b2ac75c4802dce4ca47d169657 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 11 Nov 2015 22:02:01 -0800 Subject: Remove non-smart scheduler. Don't require setitimer. This allows the server to call GetTimeInMillis() after each request is processed to avoid needing setitimer. -dumbSched now turns off the setitimer. Reviewed-by: Adam Jackson Signed-off-by: Keith Packard --- dix/dispatch.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'dix') diff --git a/dix/dispatch.c b/dix/dispatch.c index 2c201245a..53032dc64 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -222,11 +222,11 @@ UpdateCurrentTimeIf(void) #define SMART_SCHEDULE_DEFAULT_INTERVAL 5 #define SMART_SCHEDULE_MAX_SLICE 15 -#if defined(WIN32) && !defined(__CYGWIN__) -Bool SmartScheduleDisable = TRUE; -#else -Bool SmartScheduleDisable = FALSE; +#ifdef HAVE_SETITIMER +#define SMART_SCHEDULE_DEFAULT_SIGNAL_ENABLE HAVE_SETITIMER +Bool SmartScheduleSignalEnable = SMART_SCHEDULE_DEFAULT_SIGNAL_ENABLE; #endif + long SmartScheduleSlice = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleInterval = SMART_SCHEDULE_DEFAULT_INTERVAL; long SmartScheduleMaxSlice = SMART_SCHEDULE_MAX_SLICE; @@ -358,7 +358,7 @@ Dispatch(void) nready = WaitForSomething(clientReady); - if (nready && !SmartScheduleDisable) { + if (nready) { clientReady[0] = SmartScheduleClient(clientReady, nready); nready = 1; } @@ -386,8 +386,8 @@ Dispatch(void) ProcessInputEvents(); FlushIfCriticalOutputPending(); - if (!SmartScheduleDisable && - (SmartScheduleTime - start_tick) >= SmartScheduleSlice) { + if ((SmartScheduleTime - start_tick) >= SmartScheduleSlice) + { /* Penalize clients which consume ticks */ if (client->smart_priority > SMART_MIN_PRIORITY) client->smart_priority--; @@ -431,6 +431,9 @@ Dispatch(void) (*client->requestVector[client->majorOp]) (client); XaceHookAuditEnd(client, result); } + if (!SmartScheduleSignalEnable) + SmartScheduleTime = GetTimeInMillis(); + #ifdef XSERVER_DTRACE if (XSERVER_REQUEST_DONE_ENABLED()) XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp), -- cgit v1.2.3