Skip to content

3.0.0 Beta 1

Pre-release
Pre-release
Compare
Choose a tag to compare
@kelunik kelunik released this 03 Dec 00:49
v3.0.0-beta.1

Note: This is a pre-release, there might be breaking changes in the final stable version.

Event Loop

Amp no longer ships its own event loop. It's now based on Revolt. Revolt\EventLoop is quite similar to Amp's previous Amp\Loop. A very important difference is using float $seconds instead of int $milliseconds for timers.

Futures

Future is a replacement for the previous Promise. It's await() method is based on fibers and replaces generator based coroutines / Amp\Promise\wait().

  • await() accepts an optional Cancellation, which can be used as a replacement for Amp\Promise\timeout().
  • Unhandled errors are now automatically thrown into the event loop, so there's no need for Amp\Promise\rethrow() anymore.
  • Unhandled errors can be ignored using Future::ignore().

Cancellation

  • CancellationToken has been renamed to Cancellation
  • CancellationTokenSource has been renamed to DeferredCancellation
  • NullCancellationToken has been renamed to NullCancellation
  • TimeoutCancellationToken has been renamed to TimeoutCancellation
  • CombinedCancellationToken has been renamed to CompositeCancellation