start page | rating of books | rating of authors | reviews | copyrights

Perl in a Nutshell

Perl in a NutshellSearch this book
Previous: Reference: vec Chapter 5
Function Reference
Next: Reference: waitpid
 

wait

wait

Waits for a child process to terminate and returns the pid of the deceased process, or -1 if there are no child processes. The status is returned in $? . If you get zombie child processes, you should be calling either this function or waitpid . A common strategy to avoid such zombies is:

$SIG{CHLD} = sub { wait };
If you expected a child and didn't find it, 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.


Previous: Reference: vec Perl in a Nutshell Next: Reference: waitpid
Reference: vec Book Index Reference: waitpid

Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.