Improved interval handling
This commit is contained in:
parent
894ca1e544
commit
c265691e73
|
@ -37,9 +37,8 @@ static const char delimiter[] = { ' ', ' ', ' ', DELIMITERENDCHAR };
|
|||
one newline character at the end)
|
||||
* pathc - path of the program used for handling clicks on the block */
|
||||
|
||||
/* 1 interval = INTERVALs seconds, INTERVALn nanoseconds */
|
||||
#define INTERVALs 1
|
||||
#define INTERVALn 0
|
||||
/* 1 interval = <first entry> seconds, <second entry> nanoseconds */
|
||||
static const struct timespec interval = { 1, 0 };
|
||||
|
||||
static Block blocks[] = {
|
||||
/* pathu pathc interval signal */
|
||||
|
|
|
@ -139,7 +139,7 @@ statusloop()
|
|||
updateblock(block, NILL);
|
||||
updatestatus();
|
||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
||||
t.tv_sec = INTERVALs, t.tv_nsec = INTERVALn;
|
||||
t = interval;
|
||||
while (nanosleep(&t, &t) == -1)
|
||||
if (errno != EINTR) {
|
||||
perror("statusloop - nanosleep");
|
||||
|
@ -153,7 +153,7 @@ statusloop()
|
|||
updateblock(block, NILL);
|
||||
updatestatus();
|
||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
||||
t.tv_sec = INTERVALs, t.tv_nsec = INTERVALn;
|
||||
t = interval;
|
||||
while (nanosleep(&t, &t) == -1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue