pomo

A simple pomodoro timer
Log | Files | Refs | README | LICENSE

commit 22f35d5af4ee1ec7e367d14c3417f67dbc115a00
parent 0af77c1282eaf6de6f2ec3c6283c2ac2ef7ae864
Author: Simon Lieb <simon@e5150.fr>
Date:   Fri, 21 Oct 2016 13:39:01 +0200

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.

Diffstat:
Mconfig.mk | 2+-
Mspt.c | 3++-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/config.mk b/config.mk @@ -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} diff --git a/spt.c b/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++;