note 62661 added to function.pcntl-waitpid

From: Date: Mon, 06 Mar 2006 18:48:55 +0000
Subject: note 62661 added to function.pcntl-waitpid
Groups: php.notes 
Request: Send a blank email to php-notes+get-104919@lists.php.net to get a copy of this message
Here's a decent example of the pcntl_waitpid() call: $i = 0; $starttime = microtime(TRUE); $pid_arr = array(); while ($i < intval($argv[1])) { $pid = pcntl_fork(); if ($pid == -1) { die('could not fork'); } else { if ($pid) // parent { $pid_arr[$i] = $pid; } else // child { performSomeFunction($i+1); } } $i++; } foreach ($pid_arr as $pid) { // we are the parent pcntl_waitpid($pid, $status); } $elapsed = microtime(TRUE) - $starttime; print "\n==> total elapsed: " . sprintf("%f secs.\n", $elapsed); ---- Server IP: 66.163.161.117 Probable Submitter: 66.21.56.49 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.pcntl-waitpid.php Edit -- http://master.php.net/note/edit/62661 Del: integrated -- http://master.php.net/note/delete/62661/integrated Del: useless -- http://master.php.net/note/delete/62661/useless Del: bad code -- http://master.php.net/note/delete/62661/bad+code Del: spam -- http://master.php.net/note/delete/62661/spam Del: non-english -- http://master.php.net/note/delete/62661/non-english Del: in docs -- http://master.php.net/note/delete/62661/in+docs Del: other reasons-- http://master.php.net/note/delete/62661 Reject -- http://master.php.net/note/reject/62661 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104919) next »