Amp\Parallel\Worker\WorkerProcess classWorkerProcess extendsAmp\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 functionisRunning():bool

{@inheritdoc}

isIdle —public functionisIdle():bool

{@inheritdoc}

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

{@inheritdoc}

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

{@inheritdoc}

kill —public functionkill()

{@inheritdoc}

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