PHP Class Pool, ClearSky

Afficher le fichier Open project: robske110/ClearSky Class Usage Examples

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

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() public méthode

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

resize() public méthode

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

shutdown() public méthode

Shutdown all Workers in this Pool
public shutdown ( )

submit() public méthode

Submit the task to the next Worker in the Pool
public submit ( Threaded $task ) : integer
$task Threaded The task for execution
Résultat integer the identifier of the Worker executing the object

submitTo() public méthode

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
Résultat integer the identifier of the Worker that accepted the object

Property Details

$class protected_oe property

The name of the Worker class for this Pool
protected string $class
Résultat string

$ctor protected_oe property

The constructor arguments to be passed by this Pool to new Workers upon construction
protected array $ctor
Résultat array

$last protected_oe property

The numeric identifier for the last Worker used by this Pool
protected int $last
Résultat integer

$size protected_oe property

The maximum number of Worker threads allowed in this Pool
protected int $size
Résultat integer

$workers protected_oe property

The array of Worker threads for this Pool
protected array|Worker[] $workers
Résultat array | Worker[]