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\MutexandSync\Semaphoreinterfaces and related classes have been moved toamphp/sync.- Thread and process contexts are now found in the
Contextnamespace.Process\ChannelledProcessrenamed toContext\ProcessandThreading\Threadrenamed toContext\Thread. The interfaceContexthas also been moved into theContextnamespace, along with related exception classes,ContextExceptionandStatusError. - Removed the
Strandinterface.Context\Contextnow 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\Channelis given as the only function parameter.$argcand$argvare 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\Paracelrenamed toSync\ThreadedParcel.PanicErrorrenamed 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$minSizeparameter fromWorker\DefaultPool::__construct(). - When using an SAPI other than CLI,
Context\Processwill 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.