Amp\Parallel\Worker\AbstractWorker class AbstractWorker implements Amp\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 function isRunning(): bool

Checks if the worker is running.

isIdle — public function isIdle(): bool

Checks if the worker is currently idle.

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

Immediately kills the context.

cancel — protected function cancel(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