In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/237516c9c19dbadbcd600eb1e3e8bf856a48ee2a?hp=d691474c4cf3d3119367a72ebb28a990d039baf3>
- Log ----------------------------------------------------------------- commit 237516c9c19dbadbcd600eb1e3e8bf856a48ee2a Author: Lukas Mai <[email protected]> Date: Fri Jan 1 15:45:47 2016 +0100 clarify meaning of waitpid returning 0 [perl #127080] M pod/perlfunc.pod commit a6b6b8ec1b4f13c49a1d7ea81f89a87a654406cb Author: Lukas Mai <[email protected]> Date: Fri Jan 1 15:35:58 2016 +0100 explain meaning of negative PIDs in waitpid [perl #127080] M pod/perlfunc.pod ----------------------------------------------------------------------- Summary of changes: pod/perlfunc.pod | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 72e62a5..1dba05a 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -9051,9 +9051,17 @@ X<waitpid> =for Pod::Functions wait for a particular child process to die Waits for a particular child process to terminate and returns the pid of -the deceased process, or C<-1> if there is no such child process. On some -systems, a value of 0 indicates that there are processes still running. -The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>. If you say +the deceased process, or C<-1> if there is no such child process. A +non-blocking wait (with L<WNOHANG|POSIX/WNOHANG> in FLAGS) can return 0 if +there are child processes matching PID but none have terminated yet. +The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>. + +A PID of C<0> indicates to wait for any child process whose process group ID is +equal to that of the current process. A PID of less than C<-1> indicates to +wait for any child process whose process group ID is equal to -PID. A PID of +C<-1> indicates to wait for any child process. + +If you say use POSIX ":sys_wait_h"; #... @@ -9061,7 +9069,8 @@ The status is returned in C<$?> and C<${^CHILD_ERROR_NATIVE}>. If you say $kid = waitpid(-1, WNOHANG); } while $kid > 0; -then you can do a non-blocking wait for all pending zombie processes. +then you can do a non-blocking wait for all pending zombie processes (see +L<POSIX/WAIT>). Non-blocking wait is available on machines supporting either the waitpid(2) or wait4(2) syscalls. However, waiting for a particular pid with FLAGS of C<0> is implemented everywhere. (Perl emulates the -- Perl5 Master Repository
