1
0
mirror of https://github.com/danog/amp.git synced 2024-12-14 18:37:30 +01:00
Commit Graph

209 Commits

Author SHA1 Message Date
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
Daniel Lowrey
a4636851d6 remove deprecated functions 2015-07-22 14:49:40 -04:00
Daniel Lowrey
7335cb2517 use explicit FQDN for compile time optimizations 2015-07-22 13:54:29 -04:00
Daniel Lowrey
09e000a6d7 allow nested tick 2015-07-22 13:12:21 -04:00
Daniel Lowrey
1fa9771dde update coverage ignore 2015-07-22 13:12:14 -04:00
Daniel Lowrey
505c59d0e3 minor cleanup 2015-07-22 12:34:42 -04:00
Daniel Lowrey
f6be176a07 cleanup + tests 2015-07-22 11:38:17 -04:00
Daniel Lowrey
cdc5fecd47 Remove Streamable interface 2015-07-22 00:10:09 -04:00
Daniel Lowrey
79a33c09fe misc + testing 2015-07-21 23:59:20 -04:00
Daniel Lowrey
2cea028b1c filter() updates and tests 2015-07-21 20:09:27 -04:00
Daniel Lowrey
33fd20acb3 add tests 2015-07-21 17:25:18 -04:00
Daniel Lowrey
dcab6907c0 minor cleanup 2015-07-21 17:25:11 -04:00
Daniel Lowrey
d6b674b93b Move coroutine functions into new Coroutine class 2015-07-21 16:14:50 -04:00
Daniel Lowrey
564a81c519 misc updates + tests 2015-07-21 12:25:34 -04:00
Daniel Lowrey
c8bbf8208f misc updates 2015-07-20 22:40:06 -04:00
Daniel Lowrey
0e6560070b misc updates and tests 2015-07-20 22:27:11 -04:00
Daniel Lowrey
10037fe859 Miscellaneous reactor cleanup 2015-07-20 15:42:56 -04:00
Daniel Lowrey
288530d296 Add EvReactor 2015-07-20 15:42:42 -04:00
Daniel Lowrey
28154b4d70 Fix missing stream property assignment 2015-07-19 13:53:26 -04:00
Daniel Lowrey
d8a0c147e6 Add manual watcher refcount manipulation methods 2015-07-10 15:36:13 -04:00
Daniel Lowrey
4d4e9bad32 Replace BaseException refs with Throwable 2015-07-07 10:15:57 -04:00
Daniel Lowrey
ad96a584d5 Check coroutine nesting level before incurring "next tick" overhead 2015-06-16 12:08:24 -04:00
Daniel Lowrey
c7d0f3f86e error traceback improvement 2015-06-16 11:10:53 -04:00
Daniel Lowrey
40fbb6e16d Minor coroutine refactoring/optimization; add makeGeneratorError() 2015-06-16 10:59:44 -04:00
Daniel Lowrey
1d777c7e3e Remove custom coroutine promisifier support 2015-06-15 17:53:58 -04:00
Markus Staab
f06f803e76 fixed code to adhere to the phpdoc'ed description 2015-06-15 17:47:02 -04:00
Daniel Lowrey
1a891f54ac Remove streamable support in coroutine resolution 2015-06-15 13:17:27 -04:00
Daniel Lowrey
57c0f222ea Support extended generator error debugging output in PHP7 2015-06-15 11:56:42 -04:00
Daniel Lowrey
deedb4a7fa minor coroutine optimization to avoid extra valid() fcall 2015-06-15 10:58:24 -04:00
Bob Weinand
298357f760 We need to check for Generator::getReturn() in ≥ PHP 7 2015-06-13 18:37:04 +02:00
Daniel Lowrey
8a8930c8fd Fix exception breakage across 5.x/7 environments 2015-06-11 15:22:14 -04:00
Daniel Lowrey
7ce6734976 Fix potential illegal offset access 2015-06-10 15:32:02 -04:00
Bob Weinand
80fb080470 I/O watchers must be always cleared, even if disabled
Not clearing I/O watcher lead to a leftover disabled watcher, so that streamIdPollMap still contains a disabled watcher with the flag.
Which may lead to a new watcher of same type not triggering an uv_poll_start().
2015-06-10 20:10:33 +02:00
Daniel Lowrey
f2a0488d87 Add Amp\promises() to coalesce values/promises/promisors to promises 2015-06-09 11:49:22 -04:00
Daniel Lowrey
1ac3d96d24 Remove Exception hint because it breaks on PHP7 BaseException 2015-06-08 15:11:17 -04:00
Daniel Lowrey
e923ea3fde minor timeout function/test cleanup 2015-05-31 20:18:42 -04:00
Daniel Lowrey
34088cbf52 Add timeout() function 2015-05-31 20:13:39 -04:00
Daniel Lowrey
905d5bfc2c update docblock 2015-05-31 19:51:09 -04:00
Daniel Lowrey
954eaabcf5 Make promise updates variadic (ugly) 2015-05-31 19:33:55 -04:00