Amp\Parallel\Worker\WorkerProcess class WorkerProcess extends Amp\Parallel\Worker\AbstractWorker

A worker process that executes task objects.

Summary

Properties

Methods

Methods

__construct — public function __construct(string $envClassName = BasicEnvironment::class, array $env = [], string|null $binary = null)
No documentation.
Type Parameter Description Default Value
string $envClassName Name of class implementing \Amp\Parallel\Worker\Environment to instigate. Defaults to \Amp\Parallel\Worker\BasicEnvironment. BasicEnvironment::class
array $env Array of environment variables to pass to the worker. Empty array inherits from the current PHP process. See the $env parameter of \Amp\Process\Process::__construct(). []
string|null $binary Path to PHP binary. Null will attempt to automatically locate the binary. null
isRunning — public function isRunning(): bool

{@inheritdoc}

isIdle — public function isIdle(): bool

{@inheritdoc}

enqueue — public function enqueue(Amp\Parallel\Worker\Task $task): Amp\Promise

{@inheritdoc}

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

{@inheritdoc}

kill — public function kill()

{@inheritdoc}

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