PHP_Fork
| From: | Michael Wallner | Date: | Wed, 31 Mar 2004 10:12:49 +0000 |
| Subject: | PHP_Fork | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11552@lists.php.net to get a copy of this message | ||
Hi folks,
I guess I have problems to fully understand how this
package works, so maybe someone could help me and
answer some questions by example.
I wonder if the following would do what it should do:
### --- ###
class Process extends PHP_Fork
{
function Process()
{
parent::PHP_Fork(uniqid('Process', true));
}
function run(&$obj, &$handler)
{
$obj->write($handler->responseTo($obj->read()));
}
}
$hdlrs = array();
$procs = array();
while (list($key) = each($objArray)) {
$procs[$key] = &new Process;
$hdlrs[$key] = &new Handler;
$procs[$key]->run($objArray[$key], $hdlrs[$key]);
}
### --- ###
So...? :-)
[ ] Process::run() is executed by another PHP process and
no matter how long it may take, the script continues
[ ] I need a handler for each process, because if there would
only be one handler, it would be blocked by each process
[ ] the child processes terminate after Process::run() has finished
[ ] there's a better way to do the same like above
[ ] I'm completely wrong :-)
Many thanks in advance,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc