1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

Use inotify to check for changes to the defaults database. Workaround for

event handler timer.

After upgrading my kernel recently I noticed that dnotify has been
depreciated, so I decided to try and implement the new inotify code in
Window Maker instead.

During testing, I also found that one of the timers which was removed
(the one causing the most wake-ups), calling delayedAction, was
responsible for handling signals. Basically with this timer removed,
signals were only handled after an X event occurs.

After looking at the delayedAction function, I couldn't see the purpose of it.
It certainly wouldn't cause any delay as it was called by the timer every
500ms, so there is no time correlation with when a signal was received.
Also, it appeared to count the signals and call DispatchEvent for each
one, but it appears DispatchEvent would just handle the most recent signal
and take action on that. The signals handled by delayedAction are the
various exit and reset signals, so only one need to be handled. I
therefore have commented out delayedAction (it wasn't called by any other
procedure) and added a call to DispatchEvent imediately after the signal
is registered, in handleExitSig.

I'm not sure what problems this may cause with dead children - these are
only cleaned up after an Xevent now that the timer is removed- but I
haven't observed any problems since a few months ago.
This commit is contained in:
Rodney Padgett
2008-08-09 11:39:24 +01:00
committed by Carlos R. Mafra
parent c91bb1ba13
commit 56d8568787
5 changed files with 144 additions and 55 deletions

View File

@@ -140,7 +140,7 @@ extern Atom _XA_GNUSTEP_TITLEBAR_STATE;
extern Cursor wCursor[WCUR_LAST];
/* special flags */
extern char WDelayedActionSet;
/*extern char WDelayedActionSet;*/
/***** Local *****/
@@ -216,8 +216,10 @@ handleXIO(Display *xio_dpy)
*----------------------------------------------------------------------
* delayedAction-
* Action to be executed after the signal() handler is exited.
* This was called every 500ms to 'clean up' signals. Not used now.
*----------------------------------------------------------------------
*/
#ifdef notused
static void
delayedAction(void *cdata)
{
@@ -232,7 +234,7 @@ delayedAction(void *cdata)
*/
DispatchEvent(NULL);
}
#endif
/*
*----------------------------------------------------------------------
@@ -256,10 +258,7 @@ handleExitSig(int sig)
#endif
SIG_WCHANGE_STATE(WSTATE_NEED_RESTART);
/* setup idle handler, so that this will be handled when
* the select() is returned becaused of the signal, even if
* there are no X events in the queue */
WDelayedActionSet++;
} else if (sig == SIGUSR2) {
#ifdef SYS_SIGLIST_DECLARED
wwarning("got signal %i (%s) - rereading defaults\n", sig, sys_siglist[sig]);
@@ -268,10 +267,7 @@ handleExitSig(int sig)
#endif
SIG_WCHANGE_STATE(WSTATE_NEED_REREAD);
/* setup idle handler, so that this will be handled when
* the select() is returned becaused of the signal, even if
* there are no X events in the queue */
WDelayedActionSet++;
} else if (sig==SIGTERM || sig==SIGINT || sig==SIGHUP) {
#ifdef SYS_SIGLIST_DECLARED
wwarning("got signal %i (%s) - exiting...\n", sig, sys_siglist[sig]);
@@ -281,10 +277,10 @@ handleExitSig(int sig)
SIG_WCHANGE_STATE(WSTATE_NEED_EXIT);
WDelayedActionSet++;
}
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
DispatchEvent(NULL); /* Dispatch events imediately.*/
}
/* Dummy signal handler */
@@ -348,8 +344,6 @@ buryChild(int foo)
NotifyDeadProcess(pid, WEXITSTATUS(status));
}
WDelayedActionSet++;
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
errno = save_errno;