Amp\Parallel\Worker\WorkerThread class WorkerThread extends Amp\Parallel\Worker\AbstractWorker

A worker thread that executes task objects.

Summary

Properties

Methods

Methods

__construct — public function __construct(string $envClassName = BasicEnvironment::class)
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
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