\duncan3dc\ForkerPcntlAdapter

Handle multi-threading using the pcntl module.

Summary

Methods
Properties
Constants
__construct()
call()
wait()
getExceptions()
cleanup()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$memory
N/A

Properties

Methods

__construct()

__construct() 

Create a new instance.

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) : integer

Wait for the a thread started via call() to end.

Parameters

integer $pid

The pid to wait for

Returns

integer —

The exit code of the thread

getExceptions()

getExceptions() : array<mixed,\Throwable>

Get any exceptions thrown by the threads.

Returns

array<mixed,\Throwable>

cleanup()

cleanup() : void

Method to be called when the adapter is finished with.

A destructor can't be used as instances in forked threads will be destroyed twice.