Name

waitpid

Synopsis

waitpid pid, flags
                  

Waits for a particular child process pid to terminate and returns the pid when the process is dead, or -1 if there are no child processes or if the flags specify nonblocking and the process isn’t dead yet. The status of the dead process is returned in $?. To get valid flag values, do the following:

use POSIX "sys_wait_h";

On systems that implement neither the waitpid(2) nor the wait4(2) system call, flags may be specified only as 0. In other words, you can wait for a specific pid, but you can’t do it in nonblocking mode.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.