diff --git a/bin/myisam/PowerProcess.class.php b/bin/myisam/PowerProcess.class.php index 87ba4780f..e7570ae3b 100755 --- a/bin/myisam/PowerProcess.class.php +++ b/bin/myisam/PowerProcess.class.php @@ -129,7 +129,7 @@ class PowerProcess { * * @var integer */ - private $tickCount = 10000; + private $tickCount = 200000; /** * Whether to add a timestamp to log output @@ -172,6 +172,8 @@ class PowerProcess { * * @var array */ + private $shutdownCallback = null; + private $signalArray = array( SIGUSR1, // User-Defined 1 SIGUSR2 // User-Defined 2 @@ -465,6 +467,20 @@ class PowerProcess { return false; } } + + public function setCallback($callback = null) { + $this->shutdownCallback = $callback; + } + + public function runParentCode() { + if (!$this->complete) { + return $this->parentCheck(); + } else { + if ($this->shutdownCallback !== null) + call_user_func($this->shutdownCallback); + return false; + } + } /** * Determines whether we should be running the child code @@ -512,22 +528,14 @@ class PowerProcess { * * @param boolean $exit When set to true, Shutdown causes the script to exit */ - public function Shutdown($exit = true) { - while ($this->ThreadCount()) { + public function Shutdown() { + while($this->ThreadCount()) { $this->CheckThreads(); $this->Tick(); } - $this->complete = true; - - // Send custom shutdown signal - $this->SignalDispatch('shutdown'); - - if ($exit) exit; - - return self::CALLBACK_IGNORE; } - + /** * Determines if a new process can be spawned * @@ -803,4 +811,3 @@ class PowerProcess { } } - diff --git a/bin/myisam/backfill_threaded.php b/bin/myisam/backfill_threaded.php index 31360165a..3b3244e06 100755 --- a/bin/myisam/backfill_threaded.php +++ b/bin/myisam/backfill_threaded.php @@ -4,7 +4,7 @@ $newzpath = getenv('NEWZPATH'); require_once("$newzpath/www/config.php"); require_once(WWW_DIR."/lib/groups.php"); require_once(WWW_DIR."/lib/binaries.php"); -require_once('PowerProcess.class.php'); +require_once("PowerProcess.class.php"); $groups = new Groups; $groupList = $groups->getActive(); diff --git a/bin/myisam/update_binaries_threaded.php b/bin/myisam/update_binaries_threaded.php index 10b85e83f..691af23f3 100755 --- a/bin/myisam/update_binaries_threaded.php +++ b/bin/myisam/update_binaries_threaded.php @@ -5,7 +5,7 @@ $newzpath = getenv('NEWZPATH'); require("$newzpath/www/config.php"); require_once(WWW_DIR."/lib/groups.php"); require_once(WWW_DIR."/lib/binaries.php"); -require_once('PowerProcess.class.php'); +require_once("PowerProcess.class.php"); $groups = new Groups; $groupList = $groups->getActive();