From 1d83d2a74e54382ef9182ad7b136a676c6a8be1c Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 21 Dec 2011 07:45:30 +0100 Subject: page, mothra: corral rogue note groups --- sys/src/cmd/page.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sys/src/cmd/page.c') diff --git a/sys/src/cmd/page.c b/sys/src/cmd/page.c index e5445e671..dffedc0c4 100644 --- a/sys/src/cmd/page.c +++ b/sys/src/cmd/page.c @@ -1160,11 +1160,12 @@ eresized(int new) unlockdisplay(display); } +int cohort = -1; void killcohort(void) { int i; for(i=0;i!=3;i++){ /* It's a long way to the kitchen */ - postnote(PNGROUP, getpid(), "kill"); + postnote(PNGROUP, cohort, "kill"); sleep(1); } } @@ -1219,9 +1220,15 @@ main(int argc, char *argv[]) * so that we can stop all subprocesses with a note, * and to isolate rendezvous from other processes */ - rfork(RFNOTEG|RFNAMEG|RFREND); - atexit(killcohort); atnotify(catchnote, 1); + if(cohort = rfork(RFPROC|RFNOTEG|RFNAMEG|RFREND)){ + atexit(killcohort); + waitpid(); + exits(0); + } + cohort = getpid(); + atexit(killcohort); + if(newwin > 0){ s = smprint("-pid %d", getpid()); if(newwindow(s) < 0) -- cgit v1.2.3