Amp\Parallel\Worker\DefaultWorkerFactory class DefaultWorkerFactory implements Amp\Parallel\Worker\WorkerFactory

The built-in worker factory type.

Summary

Properties

Methods

Properties

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 in each worker. Defaults to \Amp\Parallel\Worker\BasicEnvironment. BasicEnvironment::class
create — public function create(): Amp\Parallel\Worker\Worker

Creates a new worker instance.

The type of worker created depends on the extensions available. If multi-threading is enabled, a WorkerThread will be created. If threads are not available a WorkerProcess will be created.