PHP Класс Jenner\SimpleFork\Process

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$callbacks array
$errmsg error message
$errno error code
$if_signal boolean
$name custom process name
$pid integer
$runnable Jenner\SimpleFork\Runnable | callable
$running boolean
$signal_handlers signal handlers
$started if the process is started
$stop_signal the signal which made the process stop
$term_signal the signal which made the process terminate

Открытые методы

Метод Описание
__construct ( string $execution = null, null $name = null )
errmsg ( ) : string get pcntl errmsg
errno ( ) : integer get pcntl errno
getPid ( ) : integer get pid
ifSignal ( )
isRunning ( ) : boolean if the process is running
isStarted ( ) : boolean if the process is started
isStopped ( ) : boolean if the process is stopped
name ( string | null $name = null ) : mixed get or set name
registerSignalHandler ( $signal, callable $handler ) register sub process signal handler, when the sub process start, the handlers will be registered
run ( ) you should overwrite this function if you do not use the Runnable or callback.
shutdown ( boolean | true $block = true, integer $signal = SIGTERM ) kill self
start ( ) : string start the sub process and run the callback
wait ( boolean | true $block = true, integer $sleep = 100000 ) waiting for the sub process exit

Защищенные методы

Метод Описание
getCallable ( ) : array | callable | null get sub process callback
initStatus ( ) init process status
signal ( ) register signal SIGTERM handler, when the parent process call shutdown and use the default signal, this handler will be triggered
updateStatus ( boolean $block = false ) update the process status

Описание методов

__construct() публичный метод

public __construct ( string $execution = null, null $name = null )
$execution string it can be a Runnable object, callback function or null
$name null process name,you can manager the process by it's name.

errmsg() публичный метод

get pcntl errmsg
public errmsg ( ) : string
Результат string

errno() публичный метод

get pcntl errno
public errno ( ) : integer
Результат integer

getCallable() защищенный метод

get sub process callback
protected getCallable ( ) : array | callable | null
Результат array | callable | null

getPid() публичный метод

get pid
public getPid ( ) : integer
Результат integer

ifSignal() публичный метод

public ifSignal ( )

initStatus() защищенный метод

init process status
protected initStatus ( )

isRunning() публичный метод

if the process is running
public isRunning ( ) : boolean
Результат boolean

isStarted() публичный метод

if the process is started
public isStarted ( ) : boolean
Результат boolean

isStopped() публичный метод

if the process is stopped
public isStopped ( ) : boolean
Результат boolean

name() публичный метод

get or set name
public name ( string | null $name = null ) : mixed
$name string | null
Результат mixed

registerSignalHandler() публичный метод

register sub process signal handler, when the sub process start, the handlers will be registered
public registerSignalHandler ( $signal, callable $handler )
$signal
$handler callable

run() публичный метод

you should overwrite this function if you do not use the Runnable or callback.
public run ( )

shutdown() публичный метод

kill self
public shutdown ( boolean | true $block = true, integer $signal = SIGTERM )
$block boolean | true
$signal integer

signal() защищенный метод

register signal SIGTERM handler, when the parent process call shutdown and use the default signal, this handler will be triggered
protected signal ( )

start() публичный метод

start the sub process and run the callback
public start ( ) : string
Результат string pid

updateStatus() защищенный метод

update the process status
protected updateStatus ( boolean $block = false )
$block boolean

wait() публичный метод

waiting for the sub process exit
public wait ( boolean | true $block = true, integer $sleep = 100000 )
$block boolean | true if block the process
$sleep integer default 0.1s check sub process status every $sleep milliseconds.

Описание свойств

$callbacks защищенное свойство

protected array $callbacks
Результат array

$errmsg защищенное свойство

error message
protected $errmsg

$errno защищенное свойство

error code
protected $errno

$if_signal защищенное свойство

protected bool $if_signal
Результат boolean

$name защищенное свойство

custom process name
protected $name

$pid защищенное свойство

protected int $pid
Результат integer

$runnable защищенное свойство

protected Runnable,Jenner\SimpleFork|callable $runnable
Результат Jenner\SimpleFork\Runnable | callable

$running защищенное свойство

protected bool $running
Результат boolean

$signal_handlers защищенное свойство

signal handlers
protected $signal_handlers

$started защищенное свойство

if the process is started
protected $started

$stop_signal защищенное свойство

the signal which made the process stop
protected $stop_signal

$term_signal защищенное свойство

the signal which made the process terminate
protected $term_signal