the best form to wait the finish of execution of a child...

Dirk-Willem van Gulik dirkx at webweaving.org
Wed Mar 30 11:56:29 PST 2005



On Wed, 30 Mar 2005, zean zean wrote:

> while(childpid != wait(&status))
> Any aid to obtain the best way is very welcome.

If you are waiting for a specific child temrimatingin see 'waitpid(); (or
wait4() - "man wait4") -- that safes you the while() loop. It allows you
to listen for just the child you want.

If you just want to -know- if a child dies but simply allow your program
to continue then install a signal handler on SIGCHLD.

The best book I personally found is to get is "Advanced Programming in the
UNIX Environment" by Richard Stevens.

Dw


More information about the freebsd-hackers mailing list