Skip to content

2.0.0

Compare
Choose a tag to compare
@trowski trowski released this 21 Feb 05:11
· 47 commits to 2.x since this release
v2.0.0
d66e3df

Stable release compatible with AMPHP v3 and fibers! 🎉

As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.

All classes related to ext-pthreads have been removed as this extension does not have releases on PHP 8.x.

Classes in the Amp\Parallel\Sync namespace have been moved to amphp/sync.

Context

  • Process renamed to ProcessContext
  • Parallel renamed to ThreadContext
  • Context::isRunning() and Context::kill() replaced by Context::isClosed() and Context::close()
  • Context related functions:
    • runstartContext
    • factorycontextFactory
    • create has been removed, use startContext
  • Xdebug ini settings are forwarded to processes created by ProcessContext (including workers executing tasks), allowing step debugging through IDEs such as PhpStorm.
  • Improved UX of uncaught exceptions in child processes and task runs. The full stack trace in the context is displayed when converting the ContextPanicError or TaskFailureThrowable to a string, i.e., when the exception is uncaught in the parent and is written to STDERR
  • Added an optional Cancellation argument to ContextFactory::start()

Worker

  • Pool renamed to WorkerPool and DefaultPool renamed to ContextWorkerPool
  • TaskWorker has been marked as internal. Use a WorkerFactory to create Worker instances or use WorkerPool::getWorker() to get a worker from a pool
  • TaskRunner has been removed
  • Removed deprecated TaskException and TaskError
  • Worker::enqueue() renamed to Worker::submit(), which now returns an Execution object
    • Execution::getFuture() returns a future that resolves to the eventual return value of the Task
    • Execution::await() awaits the result of the Task, it is a shortcut to calling Execution::getFuture()->await()
    • Execution::getChannel() returns a Channel that can be used to communicate with the Channel provided to Task::run()
    • The arguments to Task::run() have changed to Channel and Cancellation

IpcHub

Inter-process communication is now exposed as part of the public API for potential use outside of the context and worker components.