PHP Class Ko\ProcessManager

Author: Nikolay Bondarenko ([email protected])
Inheritance: implements Countable, use trait Ko\Mixin\ProcessTitle, use trait Ko\Mixin\EventEmitter
Afficher le fichier Open project: misterion/ko-process Class Usage Examples

Protected Properties

Свойство Type Description
$children ko\Process[]
$sigTerm boolean
$signalHandler ko\SignalHandler
$spawnWatch ko\Process[]

Méthodes publiques

Méthode Description
__construct ( )
count ( ) : integer Return count of currently running child process.
demonize ( ) Forks the currently running process to detach from console.
dispatch ( ) Calls signal handlers for pending signals.
dispatchSignals ( ) Calls signal handlers for pending signals.
fork ( callable $callable ) : ko\Process Forks the currently running process.
getProcessCount ( ) : integer Return count of currently running child process.
handleSigChild ( )
handleSigTerm ( )
hasAlive ( ) : boolean Return TRUE is manager has alive children processes.
onShutdown ( callable $callable ) Master process shutdown handler. Shutdown handler called right after the SIGTERM catches by this class.
spawn ( callable $callable ) : ko\Process
wait ( ) Suspends execution of the current process until all children has exited, or until a signal is delivered whose action is to terminate the current process.

Méthodes protégées

Méthode Description
childProcessDie ( $pid, $status )
createProcess ( callable $callable )
internalEmit ( )
internalFork ( ko\Process $p ) : ko\Process
internalOn ( )
internalSpawn ( ko\Process $p )
setupSignalHandlers ( )

Method Details

__construct() public méthode

public __construct ( )

childProcessDie() protected méthode

protected childProcessDie ( $pid, $status )

count() public méthode

Return count of currently running child process.
public count ( ) : integer
Résultat integer

createProcess() protected méthode

protected createProcess ( callable $callable )
$callable callable

demonize() public méthode

Forks the currently running process to detach from console.
public demonize ( )

dispatch() public méthode

Calls signal handlers for pending signals.
public dispatch ( )

dispatchSignals() public méthode

Calls signal handlers for pending signals.
Deprecation: Use ProcessManager::dispatch()
public dispatchSignals ( )

fork() public méthode

Forks the currently running process.
public fork ( callable $callable ) : ko\Process
$callable callable Callable with prototype like function(Ko\Process $p) }
Résultat ko\Process

getProcessCount() public méthode

Return count of currently running child process.
public getProcessCount ( ) : integer
Résultat integer

handleSigChild() public méthode

public handleSigChild ( )

handleSigTerm() public méthode

public handleSigTerm ( )

hasAlive() public méthode

Return TRUE is manager has alive children processes.
public hasAlive ( ) : boolean
Résultat boolean

internalEmit() protected méthode

protected internalEmit ( )

internalFork() protected méthode

protected internalFork ( ko\Process $p ) : ko\Process
$p ko\Process
Résultat ko\Process

internalOn() protected méthode

protected internalOn ( )

internalSpawn() protected méthode

protected internalSpawn ( ko\Process $p )
$p ko\Process

onShutdown() public méthode

Master process shutdown handler. Shutdown handler called right after the SIGTERM catches by this class.
public onShutdown ( callable $callable )
$callable callable

setupSignalHandlers() protected méthode

protected setupSignalHandlers ( )

spawn() public méthode

public spawn ( callable $callable ) : ko\Process
$callable callable Callable with prototype like function(Ko\Process $p) }
Résultat ko\Process

wait() public méthode

Suspends execution of the current process until all children has exited, or until a signal is delivered whose action is to terminate the current process.
public wait ( )

Property Details

$children protected_oe property

protected Process[],ko $children
Résultat ko\Process[]

$sigTerm protected_oe property

protected bool $sigTerm
Résultat boolean

$signalHandler protected_oe property

protected SignalHandler,ko $signalHandler
Résultat ko\SignalHandler

$spawnWatch protected_oe property

protected Process[],ko $spawnWatch
Résultat ko\Process[]