February 2012
Intermediate to advanced
1184 pages
37h 17m
English
wait
This function waits for a child process to terminate and
returns the PID of the deceased process, or –1 if there are no child processes (or, on
some systems, if child processes are being automatically reaped). The
status is returned in $?, as
described under system. If you get
zombie child processes, you should be calling this function, or waitpid.
If you expected a child and didn’t find it with wait, you probably had a call to system, a close on a pipe, or backticks
between the fork and the wait. These constructs also do a
wait(2) and may have harvested your child process.
Use waitpid to avoid this
problem.
Read now
Unlock full access