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 30
__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 39
PendingProcess as(string $key)

Add a process to the pool with a key.

Parameters

string $key

Return Value

PendingProcess

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

Start all of the processes in the pool.

The caller must wait for or stop the pool before its owning coroutine exits.

Parameters

callable|null $output

Return Value

InvokedProcessPool

Exceptions

InvalidArgumentException

at line 90
ProcessPoolResults run()

Start and wait for the processes to finish.

Return Value

ProcessPoolResults

at line 98
ProcessPoolResults wait()

Start and wait for the processes to finish.

Return Value

ProcessPoolResults

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

Dynamically proxy methods calls to a new pending process.

Parameters

string $method
array $parameters

Return Value

PendingProcess