Prefer sigsuspend(2) over pause(2)
As OpenBSD manual for pause(3) stated, this function is made obsolete by sigsuspend(2). We may think it will be removed in future for this *nix. On linux, this require defining _POSIX_C_SOURCE to 1.
This commit is contained in:
parent
0af77c1282
commit
22f35d5af4
|
@ -16,7 +16,7 @@ INCS+= `pkg-config --cflags libnotify`
|
|||
LIBS+= `pkg-config --libs libnotify`
|
||||
|
||||
# flags
|
||||
CPPFLAGS = -DVERSION=\"${VERSION}\"
|
||||
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_POSIX_C_SOURCE
|
||||
CFLAGS += -g -std=c99 -pedantic -Wall -Os ${INCS} ${DEFS} ${CPPFLAGS}
|
||||
LDFLAGS += -g ${LIBS}
|
||||
|
||||
|
|
3
spt.c
3
spt.c
|
@ -108,6 +108,7 @@ usage(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
sigset_t *emptymask = 0;
|
||||
suspend = 0;
|
||||
|
||||
ARGBEGIN {
|
||||
|
@ -135,7 +136,7 @@ main(int argc, char *argv[])
|
|||
timecount = 0;
|
||||
while (timecount < timers[i].tmr)
|
||||
if (suspend)
|
||||
pause();
|
||||
sigsuspend(emptymask);
|
||||
else {
|
||||
sleep(1);
|
||||
timecount++;
|
||||
|
|
Loading…
Reference in New Issue
Block a user