Amp\Parallel\Worker\Pool interfacePool extendsAmp\Parallel\Worker\Worker

An interface for worker pools.

Summary

Properties

Methods

Methods

get —public functionget():Amp\Parallel\Worker\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.

getWorkerCount —public functiongetWorkerCount():int

Gets the number of workers currently running in the pool.

getIdleWorkerCount —public functiongetIdleWorkerCount():int

Gets the number of workers that are currently idle.

getMaxSize —public functiongetMaxSize():int

Gets the maximum number of workers the pool may spawn to handle concurrent tasks.

isRunning —public functionisRunning():bool

Checks if the worker is running.

isIdle —public functionisIdle():bool

Checks if the worker is currently idle.

enqueue —public functionenqueue(Amp\Parallel\Worker\Task$task):Amp\Promise
No documentation.
Type Parameter Description Default Value
Amp\Parallel\Worker\Task $task No documentation. none
shutdown —public functionshutdown():Amp\Promise
No documentation.
kill —public functionkill()

Immediately kills the context.