PHP.nl

pcntl_waitid

pcntl_waitid

Waits for a child process to change state

bool **pcntl_waitid** int $idtype  $id array $info int $flags array $resource_usage

Obtains status information pertaining to termination, stop, and/or continue events in one of the caller's child processes.

Unless flag is passed, the calling process will become blocked until an error occurs, or status information becomes available that satisfies all of the following:

WNOHANG- The status information is from one of the child processes in the set of child processes specified by the and arguments. idtype``id

  • The state change in the status information matches one of the state change flags set in the argument. flags

    If matching status information is available prior to the call to , return shall be immediate. If matching status information is available for two or more child processes, the order in which their status is reported is unspecified. pcntl_waitid

Opmerking: > This documentation covers the POSIX specification of the function, along with some additional parameters specific to implementations on Linux, NetBSD and FreeBSD. Please see your system's man page for specific details as to how works on your system. waitid``waitid(2)``waitid

idtype``id The and arguments are used to specify which children to wait for. idtype``id

info The parameter is set to an array containing information about the signal. info

   array may contain the following keys:
  
 `info``signo``errno``code``status``pid``uid``utime``stime`

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

 `flags`

resource_usage The parameter is set to an array containing resource usage statistics from the child process.

  This is supported either if the wait6 system call is available
  (e.g. on FreeBSD), or on Linux through the raw waitid system call.
 `resource_usage`


returns true if
was specified and status is not available for

any process specified by and . pcntl_waitid``WNOHANG``idtype``id

returns true due to the change of state

of one of its children. pcntl_waitid

Otherwise, false is returned and can be used to get the error number. pcntl_get_last_error``errno

Opmerking: > Once an error number has been obtained, can be used to get the text message associated with it. errno``pcntl_strerror

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