diff options
author | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-12-21 07:45:30 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-12-21 07:45:30 +0100 |
commit | 1d83d2a74e54382ef9182ad7b136a676c6a8be1c (patch) | |
tree | 5ed2a3f635640fd1f6fc117b4a5acad12da224c6 /sys/src/cmd/page.c | |
parent | 4fe344847cebf9fd9071d83c6bf7ed7a6c1da35e (diff) |
page, mothra: corral rogue note groups
Diffstat (limited to 'sys/src/cmd/page.c')
-rw-r--r-- | sys/src/cmd/page.c | 13 |
1 files changed, 10 insertions, 3 deletions
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) |