PHP Класс Pool, ClearSky

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

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

Свойство Тип Описание
$class string The name of the Worker class for this Pool
$ctor array The constructor arguments to be passed by this Pool to new Workers upon construction
$last integer The numeric identifier for the last Worker used by this Pool
$size integer The maximum number of Worker threads allowed in this Pool
$workers array | Worker[] The array of Worker threads for this Pool

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

Метод Описание
__construct ( integer $size, string | null $class, array | null $ctor = [] ) Construct a new Pool of Workers
collect ( callable $collector ) Collect references to completed tasks
resize ( integer $size ) Resize the Pool
shutdown ( ) Shutdown all Workers in this Pool
submit ( Threaded $task ) : integer Submit the task to the next Worker in the Pool
submitTo ( integer $worker, Threaded $task ) : integer Submit the task to the specific Worker in the Pool

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

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

Construct a new Pool of Workers
public __construct ( integer $size, string | null $class, array | null $ctor = [] )
$size integer The maximum number of Workers this Pool can create
$class string | null The class for new Workers
$ctor array | null An array of arguments to be passed to new Workers

collect() публичный Метод

Allows the Pool to collect references determined to be garbage by the given collector
public collect ( callable $collector )
$collector callable

resize() публичный Метод

Resize the Pool
public resize ( integer $size )
$size integer The maximum number of Workers this Pool can create

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

Shutdown all Workers in this Pool
public shutdown ( )

submit() публичный Метод

Submit the task to the next Worker in the Pool
public submit ( Threaded $task ) : integer
$task Threaded The task for execution
Результат integer the identifier of the Worker executing the object

submitTo() публичный Метод

Submit the task to the specific Worker in the Pool
public submitTo ( integer $worker, Threaded $task ) : integer
$worker integer The worker for execution
$task Threaded The task for execution
Результат integer the identifier of the Worker that accepted the object

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

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

The name of the Worker class for this Pool
protected string $class
Результат string

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

The constructor arguments to be passed by this Pool to new Workers upon construction
protected array $ctor
Результат array

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

The numeric identifier for the last Worker used by this Pool
protected int $last
Результат integer

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

The maximum number of Worker threads allowed in this Pool
protected int $size
Результат integer

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

The array of Worker threads for this Pool
protected array|Worker[] $workers
Результат array | Worker[]