pcntl_rfork
pcntl_rfork
Manipulates process resources
int **pcntl_rfork** int $flags int $signal
Manipulates process resources.
flags
The parameter determines which resources of the invoking process (parent)
are shared by the new process (child) or initialized to their default values.
flags
is the logical OR of some subset of:
`flags``RFPROC``RFNOWAIT``RFFDG``RFCFDG``RFFDG``RFLINUXTHPN`
signalThe signal number.
On success, the PID of the child process is returned in the
parent's thread of execution, and a is returned in the child's
thread of execution.
On failure, a will be returned in the
parent's context, no child process will be created, and a PHP error is raised.
0``-1
Voorbeeld: example
<?php
$pid = pcntl_rfork(RFNOWAIT|RFTSIGZMB, SIGUSR1);
if ($pid > 0) {
// This is the parent process.
var_dump($pid);
} else {
// This is the child process.
var_dump($pid);
sleep(2); // as the child does not wait, so we see its "pid"
}
?>
int(77093)
int(0)
Opmerking: > This function is only available on BSD systems.
pcntl_fork``pcntl_waitpid``pcntl_signal``cli_set_process_title