Cari di Perl 
    Perl User Manual
Daftar Isi
(Sebelumnya) Wait for any child process to dieUnimport some module symbols o ... (Berikutnya)
Functions for processes and process groups

Wait for a particular child process to die

Daftar Isi

  • waitpid PID,FLAGS

    Waits for a particular child process to terminate and returns the pid ofthe deceased process, or -1 if there is no such child process. On somesystems, a value of 0 indicates that there are processes still running.The status is returned in $? and ${^CHILD_ERROR_NATIVE}. If you say

    1. use POSIX ":sys_wait_h";
    2. #...
    3. do {
    4. $kid = waitpid(-1, WNOHANG);
    5. } while $kid > 0;

    then you can do a non-blocking wait for all pending zombie processes.Non-blocking wait is available on machines supporting either thewaitpid(2) or wait4(2) syscalls. However, waiting for a particularpid with FLAGS of 0 is implemented everywhere. (Perl emulates thesystem call by remembering the status values of processes that haveexited but have not been harvested by the Perl script yet.)

    Note that on some systems, a return value of -1 could mean that childprocesses are being automatically reaped. See perlipc for details,and for other examples.

    Portability issues: waitpid in perlport.

 
Source : perldoc.perl.org - Official documentation for the Perl programming language
Site maintained by Jon Allen (JJ)     See the project page for more details
Documentation maintained by the Perl 5 Porters
(Sebelumnya) Wait for any child process to dieUnimport some module symbols o ... (Berikutnya)