1
0
mirror of https://github.com/danog/amp.git synced 2024-12-13 01:47:33 +01:00
Commit Graph

247 Commits

Author SHA1 Message Date
Niklas Keller
ba8335a329 Add 'internal' annotations to Watcher and CoroutineState 2016-09-04 14:46:12 +02:00
Bob Weinand
4f2161da5f Fix notices in NativeReactor; prepare tag 1.2.2 2016-05-12 14:54:59 +02:00
Bob Weinand
87a5f29ab4 Fix potential infinite loop in UvReactor::run(); prepare tag 1.2.1 2016-05-12 07:51:11 +02:00
Bob Weinand
452c9b7295 Force leading backslashes everywhere 2016-05-11 18:53:20 +02:00
Niklas Keller
d9aa8573f0 Throw InvalidArgumentException if argument to resolve() is neither callable nor an instance of Generator 2016-05-11 18:49:25 +02:00
Bob Weinand
92e004264c resolve() accepts callables returning generators - added to changelog 2016-05-11 18:28:19 +02:00
Chris Wright
3ab10de2a2 Accept callables to resolve() 2016-05-11 17:13:15 +01:00
Bob Weinand
cc7db038b3 Fix mem leaks & circular reference; prepare tag 1.1.1 2016-05-11 03:36:46 +02:00
Niklas Keller
7046ca47e1 Expose combined exceptions in combinator exception
Also fix indent, escape sequences and docs
2016-03-09 14:09:15 +01:00
Bob Weinand
d3212d4638 NativeReactor needs to always end in stopped state
(under normal circumstances)
2016-03-08 12:14:19 +01:00
Danack
a78cc09dac Avoid invalid escape sequences. 2016-02-24 12:56:47 +00:00
Bob Weinand
e925017519 If no timer has ever been defined, also block indef
Instead of a loop being uselessly repeated each one second (but that doesn't matter in real world actually)
2016-02-22 23:29:31 +01:00
Bob Weinand
4b667478f4 Fixed bug causing NativeReactor to run at 100% CPU
See also https://github.com/amphp/aerys/issues/68
2016-02-22 23:17:50 +01:00
Bob Weinand
5341a4cb92 Fix combinator functions, prepare tag 1.0.7
$struct->remaining may be negative in case of bare values passed to combinator functions
2016-01-09 15:19:56 +01:00
Bob Weinand
9f76a3f16e Fix NativeReactor::stop() being delayed, prepare tag 1.0.6 2015-11-16 03:02:13 +01:00
Bob Weinand
3057329a5c Update tests for CombinatorException, prepare tag 1.0.5 2015-09-30 14:31:53 +02:00
Niklas Keller
00898cd6af Convert RuntimeException to CombinatorException 2015-09-23 22:56:55 +02:00
Bob Weinand
63055f0784 AssertionException => AssertionError 2015-09-19 17:43:57 +02:00
Bob Weinand
de205d29e1 LibeventReactor::repeat() interpreted $msInterval as microseconds 2015-09-10 21:21:57 +02:00
Bob Weinand
8f884b0b9d Fix bug causing infinite busy wait with active immediates 2015-08-20 03:28:14 +02:00
Bob Weinand
e74926e7da Fix buggy keepAliveCount in NativeReactor 2015-08-20 02:21:20 +02:00
Markus Staab
f170acee71 Check array index instead of error suppression 2015-08-18 16:01:08 +02:00
Niklas Keller
8031623a8f Check array index instead of error suppression 2015-08-18 14:46:34 +02:00
Niklas Keller
2fe4c65faa Catch Throwables in __coroutineSend on PHP 7 2015-08-18 08:55:44 +02:00
Daniel Lowrey
861fca1ebd Fix outdated docblocks 2015-08-16 20:33:07 -04:00
Daniel Lowrey
3d1fde0812 Use correct uv flags to prevent UvReactor::tick() from hanging in edge-case scenarios 2015-08-11 20:01:25 -04:00
Daniel Lowrey
7df9b175ef Perform manual GC prior to run loop end 2015-08-10 13:36:25 -04:00
Daniel Lowrey
6612bb84df Revert "gc just to be safe prior to run loop exit"
This reverts commit ad4831888f.
2015-08-08 11:50:22 -04:00
Daniel Lowrey
5cad406795 Normalize coroutine() return to Promise type 2015-08-07 11:01:36 -04:00
Daniel Lowrey
ad4831888f gc just to be safe prior to run loop exit 2015-08-06 14:37:29 -04:00
Niklas Keller
39d3212fb0 Fix documentation for Failure 2015-08-05 23:45:29 +02:00
Niklas Keller
e00d5a7c41 Fix documentation for Failure 2015-08-05 22:49:32 +02:00
Daniel Lowrey
e209ee189d Don't unload watchers when the run loop finishes 2015-08-05 13:13:16 -04:00
Daniel Lowrey
a7b057ace1 Add leading namespace slash for built-in functions 2015-08-04 23:58:49 -04:00
Daniel Lowrey
cf206dd898 Add "state" key to Amp\info() return array 2015-08-04 23:47:20 -04:00
Daniel Lowrey
70f4971ae1 Remove stream() in favor of PromiseStream 2015-08-04 23:46:49 -04:00
Daniel Lowrey
7c35dc7efd Fix keep_alive refcount off-by-one error in reactor implementations 2015-08-04 23:11:52 -04:00
Daniel Lowrey
98f609a99a Clear watchers on run() loop exit, throw on invalid run/tick/stop calls 2015-08-04 11:07:13 -04:00
Daniel Lowrey
f840ee4334 update incorrect docblock 2015-08-01 23:03:25 -04:00
Daniel Lowrey
2c8727133e functor argument is now optional in Amp\filter()
If no functor parameter is supplied, all results equal to FALSE
using a (bool) cast will be removed.
2015-08-01 13:28:41 -04:00
Daniel Lowrey
705c57483b Fail promise timeout() operations using TimeoutException 2015-07-31 15:50:27 -04:00
Daniel Lowrey
094899a74b Add boolean "keep_alive" option for all watcher types
This option determines if the watcher will keep the run() loop
from returning. By default all watchers set "keep_alive" => true.
Setting this value to false is ideal for registering non-crucial
watchers (e.g. cache invalidation timers) that should run for the
life of the program but shouldn't prevent the event loop from
returning if all essential tasks have completed.

    <?php
    echo "before run\n";
    run(function () {
        immediately(function () {
            echo "immediately\n";
        });
        once(function () {
            echo "once\n";
        }, 100, ["keep_alive" => false]);
        repeat(function () {
            echo "repeat\n";
        }, 500, ["keep_alive" => false]);
        echo "onStart end\n";
    });
    echo "after run\n";

The above snippet will have the following output:

before run
immediately
after run

The Amp\info() function now also reports the number of
keep_alive watchers currently registered via the "keep_alive" key.
2015-07-31 09:32:22 -04:00
Daniel Lowrey
bdd8503cbe init() -> driver() 2015-07-31 09:32:21 -04:00
Daniel Lowrey
b1f400cad5 misc v1 cleanup 2015-07-29 23:23:53 -04:00
Daniel Lowrey
56b6330114 Use object hashes as watcher IDs 2015-07-29 22:12:53 -04:00
Daniel Lowrey
8bcbba41a0 Move to procedural API 2015-07-29 16:59:53 -04:00
Daniel Lowrey
1d9d572ee5 promise updates are no longer variadic + misc formatting 2015-07-27 10:08:02 -04:00
Daniel Lowrey
38b3fbbbbb move PromiseStream functionality into Amp\stream() 2015-07-23 15:23:45 -04:00
Daniel Lowrey
e18b090902 use fully qualified namespace for global functions 2015-07-23 01:32:52 -04:00
Daniel Lowrey
55e379e332 Rollback static coroutine methods to namespaced functions 2015-07-23 01:30:53 -04:00