- Fixed recording of stack traces for double resolution in case
AMP_DEBUGwas not set as environment variable, defaulting to0now. (#217) Loop::unreference()is ignored on invalid watchers now.- Invoke UV watchers in case no events or
UV_DISCONNECTis indicated. - Ignore
Loop::$drivernot being set during shutdown, which might happen due to the unreliable shutdown order. (#212)
- Resolution methods are now hidden in the
Promisereturned fromDeferred::promise(). Their exposure was an implementation detail and never promised by the return type ofDeferred::promise(). - A named class is now used for promises, so you don't end up with an anonymous class in
var_dump()and stack traces, which can be confusing.
- Fixed possible notices in
formatStacktrace(). This is an internal API, but the notices might appear on certain stack traces when running withAMP_DEBUG=true. - Fixed segfault with
ev, see amphp/parallel-functions#3. - Dropped multiple definitions of
DeferredandEmitter. These were introduced as performance hack, but relied onzend.assertionsbeing disabled to change behavior, which is bad. The performance impact is believed to be rather low, because coroutines are used a lot more thanDeferredin Amp v2.
- Allow
AMP_DEBUGto be defined via the environment. - Fix formatting of stack traces used for double resolution debugging.
Loop::set()replaces the current driver with a dummy driver for the time ofgc_collect_cycles()now. This allows cyclic references to be cleaned up properly before the new driver is set. Without such a fix, cyclic references might have been cleaned up later, e.g. cancelling their watcher IDs on the new loop, thereby cancelling the wrong watchers.- Promise combinator functions (
all(),any(),first(),some()) now preserve order of the given$promises` array argument.
- Fixed warnings and timers in
EventDriver. - Does no longer hide warnings from
stream_select.
- Fixed an issue where the loop blocks even though all watchers are unreferenced.
Amp\reactor()has been replaced withAmp\Loop::set()andAmp\Loop::get().Amp\driver()has been replaced withAmp\Loop\Factory::create().Amp\tick()no longer exists and doesn't have a replacement. Ticks are an internal detail.- Functions for creating and managing watchers are now static methods of
Amp\Loopinstead of functions in theAmpnamespace.once()is nowdelay()andimmediately()isdefer().- Parameter order for
delay()andrepeat()has been changed. reference()andunreference()have been added.
Amp\Pausehas been renamed toAmp\Delayedand accepts an optional resolution value now. Additionallyreference()andunreference()methods have been added.- Promise accepting functions have been moved to the
Amp\Promisenamespace. Amp\Promise\some()accepts an additional$requiredparameter.Amp\call(),Amp\asyncCall(),Amp\coroutine()andAmp\asyncCoroutine()have been added.Amp\resolve()has been removed, useAmp\call()instead.Promise::when()has been renamed toPromise::onResolve()Promise::watch()has been removed, useAmp\Iterator,amphp/byte-streamor a custom implementation that implementsAmp\Promiseinstead and provides dedicated APIs to access the previously data shared via thewatch()mechanism.Amp\Iterator,Amp\EmitterandAmp\Producerhave been added with several functions in theAmp\Iteratornamespace.- Various other changes.
- Fix notice in
NativeReactorwhen removing a handle while an event is waiting for it. (Regression fix from 1.1.1)
- Fix
uv_run()potentially exiting earlier than intended, leading to an infinite loop inUvReactor::run().
resolve()now also accepts callables returning generators.
- Fix memory leak in
NativeReactor, retaining an empty array for each stream. - Remove circular references in
UvReactorto avoid garbage collector calls.
- Add
getExceptions()method toCombinatorExceptionto get an array of all the exceptions (affectingsome()andfirst()). - Fix
NativeReactornot ending up in stopped state if primary callback didn't install any events.
- Fix
NativeReactorrunning a busy loop if no timers are active. Properly block now in NativeReactor insidestream_select().
- Several combinator functions could result in a promise already resolved exception in case some values of the array weren't promises.
- Fix issue in
NativeReactorcausingstop()to be delayed by one second.
- Convert general
RuntimeExceptionto more specificAmp\CombinatorException.
- Repeat watchers in
LibeventReactorinternally were handled in microsecond intervals instead of milliseconds.
- Fix issue in
NativeReactorcapable of causing keep alive counter corruption when a watcher was cancelled inside its own callback. - Fix issue in
UvReactorwithlibuv>= 1.1.0 causing busy loop with immediates present, but no watchers being triggered.
- Fix PHP 7 issue in which top-level
Throwables weren't caught in certain coroutine contexts. - Remove error suppression operator on optionally
nulloption assignment to avoid spuriousE_NOTICEoutput when custom error handlers are used.
- Fix bug preventing
UvReactor::tick()from returning when no events are ready for a single active IO watcher.
- Initial stable API release