mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
fixed timerhandler cpu eater
This commit is contained in:
@@ -80,7 +80,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
WMInitializeApplication("test", &argc, argv);
|
WMInitializeApplication("test", &argc, argv);
|
||||||
|
|
||||||
scr = WMOpenScreen();
|
scr = WMOpenScreen(NULL);
|
||||||
|
|
||||||
|
|
||||||
win = WMCreateWindow(scr, "eweq");
|
win = WMCreateWindow(scr, "eweq");
|
||||||
|
|||||||
@@ -345,7 +345,6 @@ checkIdleHandlers()
|
|||||||
WMBag *handlerCopy;
|
WMBag *handlerCopy;
|
||||||
WMBagIterator iter;
|
WMBagIterator iter;
|
||||||
|
|
||||||
|
|
||||||
if (!idleHandler || WMGetBagItemCount(idleHandler)==0) {
|
if (!idleHandler || WMGetBagItemCount(idleHandler)==0) {
|
||||||
W_FlushIdleNotificationQueue();
|
W_FlushIdleNotificationQueue();
|
||||||
/* make sure an observer in queue didn't added an idle handler */
|
/* make sure an observer in queue didn't added an idle handler */
|
||||||
@@ -420,8 +419,12 @@ static void
|
|||||||
delayUntilNextTimerEvent(struct timeval *delay)
|
delayUntilNextTimerEvent(struct timeval *delay)
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
|
TimerHandler *handler;
|
||||||
|
|
||||||
if (!timerHandler) {
|
handler = timerHandler;
|
||||||
|
while (handler && IS_ZERO(handler->when)) handler = handler->next;
|
||||||
|
|
||||||
|
if (!handler) {
|
||||||
/* The return value of this function is only valid if there _are_
|
/* The return value of this function is only valid if there _are_
|
||||||
timers active. */
|
timers active. */
|
||||||
delay->tv_sec = 0;
|
delay->tv_sec = 0;
|
||||||
@@ -430,12 +433,12 @@ delayUntilNextTimerEvent(struct timeval *delay)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rightNow(&now);
|
rightNow(&now);
|
||||||
if (IS_AFTER(now, timerHandler->when)) {
|
if (IS_AFTER(now, handler->when)) {
|
||||||
delay->tv_sec = 0;
|
delay->tv_sec = 0;
|
||||||
delay->tv_usec = 0;
|
delay->tv_usec = 0;
|
||||||
} else {
|
} else {
|
||||||
delay->tv_sec = timerHandler->when.tv_sec - now.tv_sec;
|
delay->tv_sec = handler->when.tv_sec - now.tv_sec;
|
||||||
delay->tv_usec = timerHandler->when.tv_usec - now.tv_usec;
|
delay->tv_usec = handler->when.tv_usec - now.tv_usec;
|
||||||
if (delay->tv_usec < 0) {
|
if (delay->tv_usec < 0) {
|
||||||
delay->tv_usec += 1000000;
|
delay->tv_usec += 1000000;
|
||||||
delay->tv_sec--;
|
delay->tv_sec--;
|
||||||
|
|||||||
@@ -472,6 +472,7 @@ extern Display *dpy;
|
|||||||
extern char *ProgName;
|
extern char *ProgName;
|
||||||
extern unsigned int ValidModMask;
|
extern unsigned int ValidModMask;
|
||||||
extern char WProgramState;
|
extern char WProgramState;
|
||||||
|
extern char WProgramSigState;
|
||||||
|
|
||||||
/****** Global Functions ******/
|
/****** Global Functions ******/
|
||||||
extern void wAbort(Bool dumpCore);
|
extern void wAbort(Bool dumpCore);
|
||||||
|
|||||||
@@ -228,9 +228,10 @@ handleXIO(Display *xio_dpy)
|
|||||||
static void
|
static void
|
||||||
delayedAction(void *cdata)
|
delayedAction(void *cdata)
|
||||||
{
|
{
|
||||||
if (WDelatedActionSet == 0)
|
if (WDelayedActionSet == 0) {
|
||||||
return;
|
return;
|
||||||
WDelayedActionSet = 0;
|
}
|
||||||
|
WDelayedActionSet--;
|
||||||
/*
|
/*
|
||||||
* Make the event dispatcher do whatever it needs to do,
|
* Make the event dispatcher do whatever it needs to do,
|
||||||
* including handling zombie processes, restart and exit
|
* including handling zombie processes, restart and exit
|
||||||
@@ -265,7 +266,7 @@ handleExitSig(int sig)
|
|||||||
/* setup idle handler, so that this will be handled when
|
/* setup idle handler, so that this will be handled when
|
||||||
* the select() is returned becaused of the signal, even if
|
* the select() is returned becaused of the signal, even if
|
||||||
* there are no X events in the queue */
|
* there are no X events in the queue */
|
||||||
WDelayedActionSet = 1;
|
WDelayedActionSet++;
|
||||||
} else if (sig == SIGUSR2) {
|
} else if (sig == SIGUSR2) {
|
||||||
#ifdef SYS_SIGLIST_DECLARED
|
#ifdef SYS_SIGLIST_DECLARED
|
||||||
wwarning(_("got signal %i (%s) - rereading defaults\n"), sig, sys_siglist[sig]);
|
wwarning(_("got signal %i (%s) - rereading defaults\n"), sig, sys_siglist[sig]);
|
||||||
@@ -277,7 +278,7 @@ handleExitSig(int sig)
|
|||||||
/* setup idle handler, so that this will be handled when
|
/* setup idle handler, so that this will be handled when
|
||||||
* the select() is returned becaused of the signal, even if
|
* the select() is returned becaused of the signal, even if
|
||||||
* there are no X events in the queue */
|
* there are no X events in the queue */
|
||||||
WDelayedActionSet = 1;
|
WDelayedActionSet++;
|
||||||
} else if (sig == SIGINT || sig == SIGHUP) {
|
} else if (sig == SIGINT || sig == SIGHUP) {
|
||||||
#ifdef SYS_SIGLIST_DECLARED
|
#ifdef SYS_SIGLIST_DECLARED
|
||||||
wwarning(_("got signal %i (%s) - exiting...\n"), sig, sys_siglist[sig]);
|
wwarning(_("got signal %i (%s) - exiting...\n"), sig, sys_siglist[sig]);
|
||||||
@@ -287,7 +288,7 @@ handleExitSig(int sig)
|
|||||||
|
|
||||||
SIG_WCHANGE_STATE(WSTATE_NEED_EXIT);
|
SIG_WCHANGE_STATE(WSTATE_NEED_EXIT);
|
||||||
|
|
||||||
WDelayedActionSet = 1;
|
WDelayedActionSet++;
|
||||||
}
|
}
|
||||||
|
|
||||||
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
|
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
|
||||||
@@ -418,7 +419,7 @@ buryChild(int foo)
|
|||||||
NotifyDeadProcess(pid, WEXITSTATUS(status));
|
NotifyDeadProcess(pid, WEXITSTATUS(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
WDelayedActionSet = 1;
|
WDelayedActionSet++;
|
||||||
|
|
||||||
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
|
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user