PHP Class Icicle\Concurrent\Worker\Pool

A worker pool is a collection of worker threads that can perform multiple tasks simultaneously. The load on each worker is balanced such that tasks are completed as soon as possible and workers are used efficiently.
Inheritance: implements Icicle\Concurrent\Worker\PoolInterface
Exibir arquivo Open project: icicleio/concurrent Class Usage Examples

Public Methods

Method Description
get ( ) : Worker Gets a worker from the pool. The worker is marked as busy and will only be reused if the pool runs out of idle workers. The worker will be automatically marked as idle once no references to the returned worker remain.
getIdleWorkerCount ( ) : integer Gets the number of workers that are currently idle.
getMaxSize ( ) : integer Gets the maximum number of workers the pool may spawn to handle concurrent tasks.
getMinSize ( ) : integer Gets the minimum number of workers the pool may have idle.
getWorkerCount ( ) : integer Gets the number of workers currently running in the pool.

Method Details

get() public method

Gets a worker from the pool. The worker is marked as busy and will only be reused if the pool runs out of idle workers. The worker will be automatically marked as idle once no references to the returned worker remain.
public get ( ) : Worker
return Worker

getIdleWorkerCount() public method

Gets the number of workers that are currently idle.
public getIdleWorkerCount ( ) : integer
return integer The number of idle workers.

getMaxSize() public method

Gets the maximum number of workers the pool may spawn to handle concurrent tasks.
public getMaxSize ( ) : integer
return integer The maximum number of workers.

getMinSize() public method

Gets the minimum number of workers the pool may have idle.
public getMinSize ( ) : integer
return integer The minimum number of workers.

getWorkerCount() public method

Gets the number of workers currently running in the pool.
public getWorkerCount ( ) : integer
return integer The number of workers.