Tuesday, April 26, 2011

Simple php multiple processes

function fork()
{
$pid = pcntl_fork();
if ($pid === -1) {
// Error
echo 'Process could not be forked';
} else if ($pid) {
// Parent
echo 'pid of the child process:'.$pid."\n";
} else {
// Child
sleep(30);
}
}

fork();

No comments:

Post a Comment