PHP Class Jenner\SimpleFork\ParallelPool

Inheritance: extends AbstractPool
Datei anzeigen Open project: huyanping/simple-fork-php Class Usage Examples

Protected Properties

Property Type Description
$max max process count
$runnable sub process callback

Public Methods

Method Description
__construct ( callable | Jenner\SimpleFork\Runnable $callback, integer $max = 4 )
count ( ) : integer return process count
getProcesses ( ) : Process[] get all processes
keep ( boolean $block = false, integer $interval = 100 ) keep sub process count
reload ( boolean $block = true ) start the same number processes and kill the old sub process just like nginx -s reload this method will block until all the old process exit;
start ( ) start the pool

Method Details

__construct() public method

public __construct ( callable | Jenner\SimpleFork\Runnable $callback, integer $max = 4 )
$callback callable | Jenner\SimpleFork\Runnable
$max integer

count() public method

return process count
public count ( ) : integer
return integer

getProcesses() public method

get all processes
public getProcesses ( ) : Process[]
return Process[]

keep() public method

keep sub process count
public keep ( boolean $block = false, integer $interval = 100 )
$block boolean block the master process to keep the sub process count all the time
$interval integer check time interval

reload() public method

start the same number processes and kill the old sub process just like nginx -s reload this method will block until all the old process exit;
public reload ( boolean $block = true )
$block boolean

start() public method

start the pool
public start ( )

Property Details

$max protected_oe property

max process count
protected $max

$runnable protected_oe property

sub process callback
protected $runnable