Amp\Parallel\Worker\AbstractWorker classAbstractWorker implementsAmp\Parallel\Worker\Worker

Base class for most common types of task workers.

Summary

Properties

Methods

Properties

Methods

__construct —public function__construct(Amp\Parallel\Context\Context$context)
No documentation.
Type Parameter Description Default Value
Amp\Parallel\Context\Context $context No documentation. none
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.

cancel —protected functioncancel(Throwable|null$exception =null)

Cancels all pending tasks and kills the context.

Type Parameter Description Default Value
Throwable|null $exception Optional exception to be used as the previous exception. null