PHP Class PHPDaemon\Thread\Generic

Author: Vasily Zorin ([email protected])
Inheritance: use trait PHPDaemon\Traits\ClassWatchdog, use trait PHPDaemon\Traits\StaticObjectWatchdog
Afficher le fichier Open project: kakserpom/phpdaemon Class Usage Examples

Méthodes publiques

Свойство Type Description
$id integer Process identificator
$signals array ..]

Protected Properties

Свойство Type Description
$collections array | Collection[] Collections of childrens
$delayedSigReg boolean If true, we do not register signals automatically at start
$pid integer PID
$shutdown boolean Is this thread shutdown?
$sigEvents array Storage of signal handler events
$terminated boolean Is this thread terminated?

Méthodes publiques

Méthode Description
__invoke ( ) : void Invoke magic method
eventSighandler ( $fd, $arg ) : void Called when a signal caught through libevent.
getId ( ) : integer Get ID of this Thread
getPid ( ) : integer Get PID of this Thread
ifExists ( ) : boolean Checks if this process does exist
ifExistsByPid ( integer $pid ) : boolean Checks if given process ID does exist
isTerminated ( ) : boolean Is this thread terminated?
setId ( $id ) : void Set ID of this Thread
setTerminated ( )
sighandler ( $signo ) : void Called when the signal is caught
signal ( $sig ) : boolean Sends arbitrary signal to the process
sleep ( $s ) : boolean Delays the process execution for the given number of seconds
start ( $clearstack = true ) : void Starts the process
stop ( $kill = false ) : void Terminates the process

Méthodes protégées

Méthode Description
backsig ( $sig ) : boolean Sends the signal to parent process
getTitle ( ) : string Returns a title of the current process
onTerminated ( )
registerEventSignals ( ) : void Register signals.
registerSignals ( ) : void Registers signals
run ( ) : void Run thread process
setTitle ( string $title ) : boolean Sets a title of the current process
shutdown ( ) : void Shutdowns the current process properly
sigchld ( ) : void Called when the signal SIGCHLD caught
sigint ( ) : void Called when the signal SIGINT caught
sigkill ( ) : void Called when the signal SIGKILL caught
sigquit ( ) : void Called when the signal SIGTERM caught
sigterm ( ) : void Called when the signal SIGTERM caught
sigtimedwait ( $signals, $siginfo, integer $sec, double $nano ) : boolean Implementation of pcntl_sigtimedwait for Mac.
sigwait ( $sec, $nano = 300000000 ) : boolean Waits for signals, with a timeout
unregisterSignals ( ) : void Unregister signals.
waitAll ( boolean $check ) : void Waits until children is alive
waitPid ( ) : boolean Checks for SIGCHLD

Method Details

__invoke() public méthode

Invoke magic method
public __invoke ( ) : void
Résultat void

backsig() protected méthode

Sends the signal to parent process
protected backsig ( $sig ) : boolean
Résultat boolean Success

eventSighandler() public méthode

Called when a signal caught through libevent.
public eventSighandler ( $fd, $arg ) : void
Résultat void

getId() public méthode

Get ID of this Thread
public getId ( ) : integer
Résultat integer

getPid() public méthode

Get PID of this Thread
public getPid ( ) : integer
Résultat integer

getTitle() protected méthode

Returns a title of the current process
protected getTitle ( ) : string
Résultat string

ifExists() public méthode

Checks if this process does exist
public ifExists ( ) : boolean
Résultat boolean Success

ifExistsByPid() public static méthode

Checks if given process ID does exist
public static ifExistsByPid ( integer $pid ) : boolean
$pid integer
Résultat boolean Success

isTerminated() public méthode

Is this thread terminated?
public isTerminated ( ) : boolean
Résultat boolean

onTerminated() protected méthode

protected onTerminated ( )

registerEventSignals() protected méthode

Register signals.
protected registerEventSignals ( ) : void
Résultat void

registerSignals() protected méthode

Registers signals
protected registerSignals ( ) : void
Résultat void

run() protected méthode

Run thread process
protected run ( ) : void
Résultat void

setId() public méthode

Set ID of this Thread
public setId ( $id ) : void
Résultat void

setTerminated() public méthode

public setTerminated ( )

setTitle() protected méthode

Sets a title of the current process
protected setTitle ( string $title ) : boolean
$title string
Résultat boolean Success

shutdown() protected méthode

Shutdowns the current process properly
protected shutdown ( ) : void
Résultat void

sigchld() protected méthode

Called when the signal SIGCHLD caught
protected sigchld ( ) : void
Résultat void

sighandler() public méthode

Called when the signal is caught
public sighandler ( $signo ) : void
Résultat void

sigint() protected méthode

Called when the signal SIGINT caught
protected sigint ( ) : void
Résultat void

sigkill() protected méthode

Called when the signal SIGKILL caught
protected sigkill ( ) : void
Résultat void

signal() public méthode

Sends arbitrary signal to the process
public signal ( $sig ) : boolean
Résultat boolean Success

sigquit() protected méthode

Called when the signal SIGTERM caught
protected sigquit ( ) : void
Résultat void

sigterm() protected méthode

Called when the signal SIGTERM caught
protected sigterm ( ) : void
Résultat void

sigtimedwait() protected méthode

Implementation of pcntl_sigtimedwait for Mac.
protected sigtimedwait ( $signals, $siginfo, integer $sec, double $nano ) : boolean
$sec integer
$nano double
Résultat boolean Success

sigwait() protected méthode

Waits for signals, with a timeout
protected sigwait ( $sec, $nano = 300000000 ) : boolean
Résultat boolean Success

sleep() public méthode

Delays the process execution for the given number of seconds
public sleep ( $s ) : boolean
Résultat boolean Success

start() public méthode

Starts the process
public start ( $clearstack = true ) : void
Résultat void

stop() public méthode

Terminates the process
public stop ( $kill = false ) : void
Résultat void

unregisterSignals() protected méthode

Unregister signals.
protected unregisterSignals ( ) : void
Résultat void

waitAll() protected méthode

Waits until children is alive
protected waitAll ( boolean $check ) : void
$check boolean
Résultat void

waitPid() protected méthode

Checks for SIGCHLD
protected waitPid ( ) : boolean
Résultat boolean Success

Property Details

$collections protected_oe property

Collections of childrens
protected array|Collection[],PHPDaemon\Thread $collections
Résultat array | Collection[]

$delayedSigReg protected_oe property

If true, we do not register signals automatically at start
protected bool $delayedSigReg
Résultat boolean

$id public_oe property

Process identificator
public int $id
Résultat integer

$pid protected_oe property

PID
protected int $pid
Résultat integer

$shutdown protected_oe property

Is this thread shutdown?
protected bool $shutdown
Résultat boolean

$sigEvents protected_oe property

Storage of signal handler events
protected array $sigEvents
Résultat array

$signals public_oe static_oe property

..]
public static array $signals
Résultat array

$terminated protected_oe property

Is this thread terminated?
protected bool $terminated
Résultat boolean