diff options
-rw-r--r-- | include/dixstruct.h | 6 | ||||
-rw-r--r-- | os/WaitFor.c | 11 | ||||
-rw-r--r-- | os/utils.c | 28 |
3 files changed, 8 insertions, 37 deletions
diff --git a/include/dixstruct.h b/include/dixstruct.h index dd6347f18..bed31dc2a 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -150,11 +150,9 @@ extern long SmartScheduleTime; extern long SmartScheduleInterval; extern long SmartScheduleSlice; extern long SmartScheduleMaxSlice; -extern unsigned long SmartScheduleIdleCount; extern Bool SmartScheduleDisable; -extern Bool SmartScheduleIdle; -extern Bool SmartScheduleTimerStopped; -extern Bool SmartScheduleStartTimer(void); +extern void SmartScheduleStartTimer(void); +extern void SmartScheduleStopTimer(void); #define SMART_MAX_PRIORITY (20) #define SMART_MIN_PRIORITY (-20) diff --git a/os/WaitFor.c b/os/WaitFor.c index ec1592c01..7683477e6 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -217,7 +217,8 @@ WaitForSomething(int *pClientsReady) XFD_COPYSET(&AllSockets, &LastSelectMask); #ifdef SMART_SCHEDULE } - SmartScheduleIdle = TRUE; + SmartScheduleStopTimer (); + #endif BlockHandler((pointer)&wt, (pointer)&LastSelectMask); if (NewOutputPending) @@ -237,13 +238,7 @@ WaitForSomething(int *pClientsReady) selecterr = GetErrno(); WakeupHandler(i, (pointer)&LastSelectMask); #ifdef SMART_SCHEDULE - if (i >= 0) - { - SmartScheduleIdle = FALSE; - SmartScheduleIdleCount = 0; - if (SmartScheduleTimerStopped) - (void) SmartScheduleStartTimer (); - } + SmartScheduleStartTimer (); #endif if (i <= 0) /* An error or timeout occurred */ { diff --git a/os/utils.c b/os/utils.c index 31cb0af92..6fc1f7d43 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1513,10 +1513,6 @@ XNFstrdup(const char *s) #ifdef SMART_SCHEDULE -unsigned long SmartScheduleIdleCount; -Bool SmartScheduleIdle; -Bool SmartScheduleTimerStopped; - #ifdef SIGVTALRM #define SMART_SCHEDULE_POSSIBLE #endif @@ -1526,7 +1522,7 @@ Bool SmartScheduleTimerStopped; #define SMART_SCHEDULE_TIMER ITIMER_REAL #endif -static void +void SmartScheduleStopTimer (void) { #ifdef SMART_SCHEDULE_POSSIBLE @@ -1537,38 +1533,28 @@ SmartScheduleStopTimer (void) timer.it_value.tv_sec = 0; timer.it_value.tv_usec = 0; (void) setitimer (ITIMER_REAL, &timer, 0); - SmartScheduleTimerStopped = TRUE; #endif } -Bool +void SmartScheduleStartTimer (void) { #ifdef SMART_SCHEDULE_POSSIBLE struct itimerval timer; - SmartScheduleTimerStopped = FALSE; timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = SmartScheduleInterval * 1000; timer.it_value.tv_sec = 0; timer.it_value.tv_usec = SmartScheduleInterval * 1000; - return setitimer (ITIMER_REAL, &timer, 0) >= 0; + setitimer (ITIMER_REAL, &timer, 0); #endif - return FALSE; } #ifdef SMART_SCHEDULE_POSSIBLE static void SmartScheduleTimer (int sig) { - int olderrno = errno; - SmartScheduleTime += SmartScheduleInterval; - if (SmartScheduleIdle) - { - SmartScheduleStopTimer (); - } - errno = olderrno; } #endif @@ -1592,14 +1578,6 @@ SmartScheduleInit (void) perror ("sigaction for smart scheduler"); return FALSE; } - /* Set up the virtual timer */ - if (!SmartScheduleStartTimer ()) - { - perror ("scheduling timer"); - return FALSE; - } - /* stop the timer and wait for WaitForSomething to start it */ - SmartScheduleStopTimer (); return TRUE; #else return FALSE; |