Anyway in java to way for the child process to wait for parent process to die
christos at zoulas.com
Thu Nov 12 00:04:05 UTC 2009
On Nov 12, 8:29am, David.Holmes at Sun.COM (David Holmes - Sun Microsystems) wrote:
-- Subject: Re: Anyway in java to way for the child process to wait for paren
| Paulo Levi said the following on 11/12/09 05:31:
| > In process builder.
| I'm not aware of any OS support for waiting for a parent process to die.
| David Holmes
All the BSD's have it.
main(int argc, char *argv)
int kq, nev;
struct kevent ev, ch;
if ((kq = kqueue()) == -1)
err(1, "Cannot create kqueue");
EV_SET(&ch, getppid(), EVFILT_PROC, EV_ADD | EV_ENABLE | EV_CLEAR,
NOTE_EXIT, 0, 0);
nev = kevent(kq, &ch, 1, &ev, 1, NULL);
if (nev == -1)
if (nev == 0)
if (ev.fflags & NOTE_EXIT)
printf("my parent is now %u\n", (unsigned)getppid());
errx("unknown flags %x", ev.fflags);
More information about the core-libs-dev