summaryrefslogtreecommitdiff
path: root/includes/ForkController.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:12:12 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:12:12 -0400
commitc9aa36da061816dee256a979c2ff8d2ee41824d9 (patch)
tree29f7002b80ee984b488bd047dbbd80b36bf892e9 /includes/ForkController.php
parentb4274e0e33eafb5e9ead9d949ebf031a9fb8363b (diff)
parentd1ba966140d7a60cd5ae4e8667ceb27c1a138592 (diff)
Merge branch 'archwiki'
# Conflicts: # skins/ArchLinux.php # skins/ArchLinux/archlogo.gif
Diffstat (limited to 'includes/ForkController.php')
-rw-r--r--includes/ForkController.php20
1 files changed, 16 insertions, 4 deletions
diff --git a/includes/ForkController.php b/includes/ForkController.php
index ced45af6..c1765e24 100644
--- a/includes/ForkController.php
+++ b/includes/ForkController.php
@@ -30,11 +30,11 @@
* @ingroup Maintenance
*/
class ForkController {
- var $children = array();
- var $termReceived = false;
- var $flags = 0, $procsToStart = 0;
+ protected $children = array(), $childNumber = 0;
+ protected $termReceived = false;
+ protected $flags = 0, $procsToStart = 0;
- static $restartableSignals = array(
+ protected static $restartableSignals = array(
SIGFPE,
SIGILL,
SIGSEGV,
@@ -137,6 +137,16 @@ class ForkController {
return 'done';
}
+ /**
+ * Get the number of the child currently running. Note, this
+ * is not the pid, but rather which of the total number of children
+ * we are
+ * @return int
+ */
+ public function getChildNumber() {
+ return $this->childNumber;
+ }
+
protected function prepareEnvironment() {
global $wgMemc;
// Don't share DB, storage, or memcached connections
@@ -150,6 +160,7 @@ class ForkController {
/**
* Fork a number of worker processes.
*
+ * @param int $numProcs
* @return string
*/
protected function forkWorkers( $numProcs ) {
@@ -166,6 +177,7 @@ class ForkController {
if ( !$pid ) {
$this->initChild();
+ $this->childNumber = $i;
return 'child';
} else {
// This is the parent process