\duncan3dc\ForkerFork

Class to make multi-threaded processes easier.

Summary

Methods
Properties
Constants
__construct()
call()
wait()
getPIDs()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$adapter
$threads
N/A

Properties

$threads

$threads : array

Type

array — The threads created.

Methods

__construct()

__construct(\duncan3dc\Forker\AdapterInterface  $adapter = null) 

Create a container to run multiple threads.

Parameters

\duncan3dc\Forker\AdapterInterface $adapter

The adapter to use to handle the threading

call()

call(callable  $func, mixed  $args) : integer

Run some code in a thread.

Parameters

callable $func

The function to execute

mixed $args

The arguments to pass to the function

Returns

integer —

The pid of the thread created to execute this code

wait()

wait(integer  $pid = null) : $this

Wait for the processes started via call().

Parameters

integer $pid

The pid to wait for, if none is passed then all threads created by this object will be waited for

Returns

$this

getPIDs()

getPIDs() : array<mixed,integer>

Get forks' PIDs.

Returns

array<mixed,integer>