BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
Pool Class Reference

Public Member Functions

 __construct ($size, $class, $ctor=[])
 
 collect ($collector)
 
 resize ($size)
 
 shutdown ()
 
 submit ($task)
 
 submitTo ($worker, $task)
 

Protected Attributes

 $size
 
 $class
 
 $ctor
 
 $workers
 
 $work
 
 $last
 

Detailed Description

A Pool is a container for, and controller of, an adjustable number of Workers.
Pooling provides a higher level abstraction of the Worker functionality, including the management of references in the way required by pthreads. http://www.php.net/manual/en/class.pool.php

Constructor & Destructor Documentation

Pool::__construct (   $size,
  $class,
  $ctor = [] 
)

(PECL pthreads >= 2.0.0) Creates a new Pool of Workers integer $size The maximum number of Workers this Pool can create

Parameters
string$class

The class for new Workers

Parameters
array$ctor

An array of arguments to be passed to new Workers

Returns
Pool

the new Pool

Member Function Documentation

Pool::collect (   $collector)

(PECL pthreads >= 2.0.0) Allows the Pool to collect references determined to be garbage by the given collector Callable $collector void

Pool::resize (   $size)

(PECL pthreads >= 2.0.0) Resize the Pool integer $size The maximum number of Workers this Pool can create

Returns
void
Pool::shutdown ( )

(PECL pthreads >= 2.0.0) Shutdown the Workers in this Pool void

Pool::submit (   $task)

(PECL pthreads >= 2.0.0) Submit the task to the next Worker in the Pool Threaded $task integer the identifier of the Worker executing the object

Pool::submitTo (   $worker,
  $task 
)

Submit the object to the specified Worker in the Pool integer $worker The worker for execution

Parameters
Threaded$task

The task for execution

Returns
integer

the identifier of the Worker that accepted the object


The documentation for this class was generated from the following file: