class Pool mixin Factory mixin PendingProcess

Properties

protected array<int|PendingProcess> $pendingProcesses

The array of pending processes.

Methods

__construct(Factory $factory, Closure $callback)

Create a new process pool.

as(string $key)

Add a process to the pool with a key.

start(callable|null $output = null)

Start all of the processes in the pool.

run()

Start and wait for the processes to finish.

wait()

Start and wait for the processes to finish.

__call(string $method, array $parameters)

Dynamically proxy methods calls to a new pending process.

Details

at line 31
__construct(Factory $factory, Closure $callback)

Create a new process pool.

Parameters

Factory $factory

the process factory instance

Closure $callback

the callback that resolves the pending processes

at line 40
PendingProcess as(string $key)

Add a process to the pool with a key.

Parameters

string $key

Return Value

PendingProcess

at line 55
InvokedProcessPool start(callable|null $output = null)

Start all of the processes in the pool.

Start the pool in the coroutine that will wait for it. Its processes are stopped when that coroutine exits unless explicitly detached by their options.

Parameters

callable|null $output

Return Value

InvokedProcessPool

Exceptions

InvalidArgumentException

at line 92
ProcessPoolResults run()

Start and wait for the processes to finish.

Return Value

ProcessPoolResults

at line 100
ProcessPoolResults wait()

Start and wait for the processes to finish.

Return Value

ProcessPoolResults

at line 108
PendingProcess __call(string $method, array $parameters)

Dynamically proxy methods calls to a new pending process.

Parameters

string $method
array $parameters

Return Value

PendingProcess