[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/ -> ForkController.php (summary)

Class for managing forking command line scripts. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 201 lines (5 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

ForkController:: (7 methods):
  __construct()
  start()
  getChildNumber()
  prepareEnvironment()
  forkWorkers()
  initChild()
  handleTermSignal()


Class: ForkController  - X-Ref

Class for managing forking command line scripts.
Currently just does forking and process control, but it could easily be extended
to provide IPC and job dispatch.

This class requires the posix and pcntl extensions.

__construct( $numProcs, $flags = 0 )   X-Ref
Pass this flag to __construct() to cause the class to automatically restart
workers that exit with non-zero exit status or a signal such as SIGSEGV.


start()   X-Ref
Start the child processes.

This should only be called from the command line. It should be called
as early as possible during execution.

This will return 'child' in the child processes. In the parent process,
it will run until all the child processes exit or a TERM signal is
received. It will then return 'done'.
return: string

getChildNumber()   X-Ref
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

prepareEnvironment()   X-Ref
No description

forkWorkers( $numProcs )   X-Ref
Fork a number of worker processes.

param: int $numProcs
return: string

initChild()   X-Ref
No description

handleTermSignal( $signal )   X-Ref
No description



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1