Bug fix and improvement - nanosleep
This commit is contained in:
parent
3bd2416d86
commit
152b3668f7
|
@ -203,19 +203,23 @@ statusloop()
|
|||
getcmd(block, NILL);
|
||||
setroot();
|
||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
||||
/* main loop */
|
||||
for (i = 1;; t.tv_sec = INTERVALs, t.tv_nsec = INTERVALn, i += 1) {
|
||||
t.tv_sec = INTERVALs, t.tv_nsec = INTERVALn;
|
||||
while (nanosleep(&t, &t) == -1)
|
||||
if (errno != EINTR) {
|
||||
perror("statusloop - nanosleep");
|
||||
exit(1);
|
||||
}
|
||||
i = 1;
|
||||
/* main loop */
|
||||
for (;; i++) {
|
||||
sigprocmask(SIG_BLOCK, &blocksigmask, NULL);
|
||||
for (Block *block = blocks; block->pathu; block++)
|
||||
if (block->interval > 0 && i % block->interval == 0)
|
||||
getcmd(block, NILL);
|
||||
setroot();
|
||||
sigprocmask(SIG_UNBLOCK, &blocksigmask, NULL);
|
||||
t.tv_sec = INTERVALs, t.tv_nsec = INTERVALn;
|
||||
while (nanosleep(&t, &t) == -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue