\duncan3dc\ForkerAdapterInterface

Summary

Methods
Constants
call()
wait()
getExceptions()
cleanup()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

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.