Unify unnecessarily scattered calls to sigprocmask
This commit is contained in:
parent
6ef0de3d10
commit
74621edcab
21
dwmblocks.c
21
dwmblocks.c
|
@ -116,10 +116,8 @@ void
|
||||||
setroot()
|
setroot()
|
||||||
{
|
{
|
||||||
if (updatestatus()) {
|
if (updatestatus()) {
|
||||||
sigprocmask(SIG_BLOCK, &blocksigmask, NULL);
|
|
||||||
XStoreName(dpy, DefaultRootWindow(dpy), statusstr);
|
XStoreName(dpy, DefaultRootWindow(dpy), statusstr);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +155,7 @@ setupsignals()
|
||||||
|
|
||||||
/* to handle update signals for individual blocks */
|
/* to handle update signals for individual blocks */
|
||||||
sa.sa_flags |= SA_NODEFER;
|
sa.sa_flags |= SA_NODEFER;
|
||||||
// sigemptyset(&sa.sa_mask);
|
sa.sa_mask = blocksigmask;
|
||||||
sa.sa_sigaction = sighandler;
|
sa.sa_sigaction = sighandler;
|
||||||
for (Block *current = blocks; current->pathu; current++)
|
for (Block *current = blocks; current->pathu; current++)
|
||||||
if (current->signal > 0)
|
if (current->signal > 0)
|
||||||
|
@ -169,11 +167,8 @@ sighandler(int signal, siginfo_t *si, void *ucontext)
|
||||||
{
|
{
|
||||||
signal -= SIGRTMIN;
|
signal -= SIGRTMIN;
|
||||||
for (Block *current = blocks; current->pathu; current++)
|
for (Block *current = blocks; current->pathu; current++)
|
||||||
if (current->signal == signal) {
|
if (current->signal == signal)
|
||||||
sigprocmask(SIG_BLOCK, &blocksigmask, NULL);
|
|
||||||
getcmd(current, si->si_value.sival_int);
|
getcmd(current, si->si_value.sival_int);
|
||||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
|
||||||
}
|
|
||||||
setroot();
|
setroot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,23 +178,21 @@ statusloop()
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* first run */
|
/* first run */
|
||||||
for (Block *current = blocks; current->pathu; current++)
|
|
||||||
if (current->interval >= 0) {
|
|
||||||
sigprocmask(SIG_BLOCK, &blocksigmask, NULL);
|
sigprocmask(SIG_BLOCK, &blocksigmask, NULL);
|
||||||
|
for (Block *current = blocks; current->pathu; current++)
|
||||||
|
if (current->interval >= 0)
|
||||||
getcmd(current, NILL);
|
getcmd(current, NILL);
|
||||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
|
||||||
}
|
|
||||||
setroot();
|
setroot();
|
||||||
|
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
||||||
sleep(SLEEPINTERVAL);
|
sleep(SLEEPINTERVAL);
|
||||||
i = SLEEPINTERVAL;
|
i = SLEEPINTERVAL;
|
||||||
/* main loop */
|
/* main loop */
|
||||||
while (statuscontinue) {
|
while (statuscontinue) {
|
||||||
for (Block *current = blocks; current->pathu; current++)
|
|
||||||
if (current->interval > 0 && i % current->interval == 0) {
|
|
||||||
sigprocmask(SIG_BLOCK, &blocksigmask, NULL);
|
sigprocmask(SIG_BLOCK, &blocksigmask, NULL);
|
||||||
|
for (Block *current = blocks; current->pathu; current++)
|
||||||
|
if (current->interval > 0 && i % current->interval == 0)
|
||||||
getcmd(current, NILL);
|
getcmd(current, NILL);
|
||||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
||||||
}
|
|
||||||
setroot();
|
setroot();
|
||||||
sleep(SLEEPINTERVAL);
|
sleep(SLEEPINTERVAL);
|
||||||
i += SLEEPINTERVAL;
|
i += SLEEPINTERVAL;
|
||||||
|
|
Loading…
Reference in a new issue