0.2.0
(Note all class and interface names below are relative to Amp\Parallel
)
- The forking context has been completely removed. Forking the entire process state proved to be too error-prone to be useful as a general-purpose parallel execution context.
Sync\Mutex
andSync\Semaphore
interfaces and related classes have been moved toamphp/sync
.- Thread and process contexts are now found in the
Context
namespace.Process\ChannelledProcess
renamed toContext\Process
andThreading\Thread
renamed toContext\Thread
. The interfaceContext
has also been moved into theContext
namespace, along with related exception classes,ContextException
andStatusError
. - Removed the
Strand
interface.Context\Context
now extendsSync\Channel
. - The process context now accepts a path to a PHP script returning a callable function. This function may return a serializable value, a promise or generator (run as a coroutine) that resolves to a serializable value. An instance of
Sync\Channel
is given as the only function parameter.$argc
and$argv
are also available as usual in CLI PHP scripts.
// process.php
use Amp\Parallel\Sync\Channel;
return function (Channel $channel) use ($argc, $argv) {
// Code executed in child process.
return $result;
};
Threading\Thread::spawn()
renamed toContext\Thread::run()
.Threading\Paracel
renamed toSync\ThreadedParcel
.PanicError
renamed toSync\PanicError
.Worker\Worker::start()
removed. It is no longer necessary to manually start a worker or pool, the underlying context will automatically be started once a task is enqueued.- Removed
Worker\Pool::getMinSize()
and the$minSize
parameter fromWorker\DefaultPool::__construct()
. - When using an SAPI other than CLI,
Context\Process
will automatically search PATH for an executable namedphp
. Alternatively, a path to the PHP binary executable may be specified by setting an environment variable or constant namedAMP_PHP_BINARY
.