PHP.nl

pcntl_waitpid

pcntl_waitpid

Waits on or returns the status of a forked child

int **pcntl_waitpid** int $process_id int $status int $flags array $resource_usage

Suspends execution of the current process until a child as specified by the argument has exited, or until a signal is delivered whose action is to terminate the current process or to call a signal handling function. process_id

If a child as requested by has already exited by the time of the call (a so-called "zombie" process), the function returns immediately. Any system resources used by the child are freed. Please see your system's waitpid(2) man page for specific details as to how waitpid works on your system. process_id

process_id The value of can be one of the following:

  `process_id`

Opmerking: > Specifying as the is equivalent to the functionality provides (minus ). -1``process_id``pcntl_wait``flags

status will store status information in the parameter which can be evaluated using the following functions: , , , , and . pcntl_waitpid``status``pcntl_wifexited``pcntl_wifstopped``pcntl_wifsignaled``pcntl_wexitstatus``pcntl_wtermsig``pcntl_wstopsig

flags The value of is the value of zero or more of the following two global constants 'ed together:

  `flags``OR`




returns the process ID of the

child which exited, -1 on error or zero if was used and no child was available pcntl_waitpid``WNOHANG

pcntl_fork``pcntl_signal``pcntl_wifexited``pcntl_wifstopped``pcntl_wifsignaled``pcntl_wexitstatus``pcntl_wtermsig``pcntl_wstopsig