summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2015-10-29 03:43:51 +0100
committerMarius Halden <marius.h@lden.org>2015-10-29 03:43:51 +0100
commit9eefb23b1596a53c05a7b198365729dccdcf97de (patch)
tree716399139ba1ac839d48a6eb5519101ec4b4305d
parent4058c3af39ea0bc93b2f98d5ef37a89a85fb96ee (diff)
downloadpiper-9eefb23b1596a53c05a7b198365729dccdcf97de.tar.gz
piper-9eefb23b1596a53c05a7b198365729dccdcf97de.tar.bz2
piper-9eefb23b1596a53c05a7b198365729dccdcf97de.tar.xz
If terminating wait a second between signaling each program
-rw-r--r--Makefile2
-rw-r--r--piper.c9
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;