From 9eefb23b1596a53c05a7b198365729dccdcf97de Mon Sep 17 00:00:00 2001 From: Marius Halden Date: Thu, 29 Oct 2015 03:43:51 +0100 Subject: If terminating wait a second between signaling each program --- Makefile | 2 +- piper.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4ba068e..a586703 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ piper: piper.c - ${CC} -o piper -g -Wall -Werror piper.c + ${CC} -o piper -Wall -Werror piper.c .PHONY: clean diff --git a/piper.c b/piper.c index 62f1b9c..ca5be7c 100644 --- a/piper.c +++ b/piper.c @@ -202,8 +202,13 @@ signal_procs() { int i; for (i = 0; i < num_procs; i++) { - if (procs[i].pid != -1) - kill(procs[i].pid, sendsignal); //XXX: Check return? + if (procs[i].pid == -1) + continue; + + kill(procs[i].pid, sendsignal); //XXX: Check return? + + if (terminate) // If killing procs, sleep between signals + sleep(1); } sendsignal = 0; -- cgit v1.2.3