Skip to content

Instantly share code, notes, and snippets.

@travail
Created March 17, 2010 17:23
Show Gist options
  • Select an option

  • Save travail/335483 to your computer and use it in GitHub Desktop.

Select an option

Save travail/335483 to your computer and use it in GitHub Desktop.
<?php
require_once 'Parallel/Prefork.php';
$pm = new Parallel_Prefork(array(
'max_workers' => 10,
'fork_delay' => 1,
'trap_signals' => array(
SIGTERM => SIGTERM,
SIGHUP => SIGTERM,
SIGUSR1 => null,
),
));
while ($pm->signalReceived() !== SIGTERM) {
load_config();
if ($pm->start() === true) {
continue;
}
... do some work within the child process ...
$pm->finish();
}
$pm->waitAllChildren();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment