rainman rainman - 1 year ago 80
C Question

Communication between a parent process and the OS

Does anybody know if a parent process can be notified that its child has finished without being blocked in the function

, and avoid that the child process become a zombie ?

Answer Source

You probably want waitpid() instead of wait().

waitpid(0, NULL, WNOHANG)

This will return the pid of a dead child, or -1 immediately if there are none.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download