PHP Class PHPDaemon\Thread\Collection

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

Public Properties

Property Type Description
$threads Generic[] Array of threads

Protected Properties

Property Type Description
$spawnCounter integer Counter of spawned threads

Public Methods

Method Description
getCount ( ) : integer Return the collected threads count
push ( Generic $thread ) : void Pushes certain thread to the collection
removeTerminated ( ) : integer Remove terminated threads from the collection
signal ( $sig ) : void Send a signal to threads
start ( ) : void Start all collected threads
stop ( $kill = false ) : void Stop all collected threads

Method Details

getCount() public method

Return the collected threads count
public getCount ( ) : integer
return integer Count

push() public method

Pushes certain thread to the collection
public push ( Generic $thread ) : void
$thread Generic
return void

removeTerminated() public method

Remove terminated threads from the collection
public removeTerminated ( ) : integer
return integer Rest threads count

signal() public method

Send a signal to threads
public signal ( $sig ) : void
return void

start() public method

Start all collected threads
public start ( ) : void
return void

stop() public method

Stop all collected threads
public stop ( $kill = false ) : void
return void

Property Details

$spawnCounter protected property

Counter of spawned threads
protected int $spawnCounter
return integer

$threads public property

Array of threads
public Generic[],PHPDaemon\Thread $threads
return Generic[]