1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00
Commit Graph

93 Commits

Author SHA1 Message Date
Aaron Piotrowski
69ec812bc0 Require PHP 7 2016-08-11 14:52:40 -05:00
Aaron Piotrowski
9055f159e7 Revert some() to v1 behavior 2016-07-31 00:31:04 -05:00
Aaron Piotrowski
5a06b1cdc1 Update tests and remove unused tests 2016-07-19 00:05:40 -05:00
Aaron Piotrowski
ade997688a Merge branch 'awaitable' into v2 2016-07-18 23:20:05 -05:00
Aaron Piotrowski
3f654cbd5b Initial tests plus some fixes 2016-07-12 11:20:06 -05:00
Chris Wright
6f4433dd1c Add tests for resolve callables 2016-05-11 18:07:58 +01: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
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
72683085c5 Fix signal tests for when pcntl isn't loaded, but UvReactor is 2015-11-16 14:53:19 +01:00
Bob Weinand
3057329a5c Update tests for CombinatorException, prepare tag 1.0.5 2015-09-30 14:31:53 +02:00
Daniel Lowrey
5cad406795 Normalize coroutine() return to Promise type 2015-08-07 11:01:36 -04:00
Daniel Lowrey
e209ee189d Don't unload watchers when the run loop finishes 2015-08-05 13:13:16 -04:00
Daniel Lowrey
70f4971ae1 Remove stream() in favor of PromiseStream 2015-08-04 23:46:49 -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
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
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
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
55e379e332 Rollback static coroutine methods to namespaced functions 2015-07-23 01:30:53 -04:00
Daniel Lowrey
f6be176a07 cleanup + tests 2015-07-22 11:38:17 -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
932542f292 add map() combinator tests 2015-07-21 19:41:39 -04:00
Daniel Lowrey
33fd20acb3 add tests 2015-07-21 17:25:18 -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
0d14e906f8 Add Pause test coverage 2015-07-20 22:29:17 -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
1a891f54ac Remove streamable support in coroutine resolution 2015-06-15 13:17:27 -04:00
Daniel Lowrey
f2a0488d87 Add Amp\promises() to coalesce values/promises/promisors to promises 2015-06-09 11:49:22 -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
954eaabcf5 Make promise updates variadic (ugly) 2015-05-31 19:33:55 -04:00
Daniel Lowrey
80548311af Use the same tests as master 2015-05-25 13:33:06 -04:00
Daniel Lowrey
0c0395f7a0 Fix UvReactor bugs 2015-05-25 12:47:04 -04:00
Daniel Lowrey
f024061d22 Fix buggy PromiseStream behavior 2015-05-23 16:46:55 -04:00
Daniel Lowrey
71f9687cff Reactor watcher option "callback_data" renamed "cb_data" 2015-05-20 15:21:59 -04:00
Daniel Lowrey
c7e4e8d0c3 Miscellaneous function changes (more after jump)
- Combinator functions optimized for performance
- Amp\reactor() now accepts an optional assignment parameter for
  modifying the global default event reactor instance to allow for
  third-party Reactor implementations.
- Renamed functions:
    . Amp\getReactor() -> Amp\reactor()
- Removed functions:
    . Amp\chooseReactor()
    . Amp\tick()
    . Amp\immediately()
    . Amp\once()
    . Amp\repeat()
    . Amp\onReadable()
    . Amp\onWritable()
    . Amp\onSignal()
    . Amp\enable()
    . Amp\disable()
    . Amp\cancel()
2015-05-20 15:18:30 -04:00
Daniel Lowrey
fc600d46ab Pass optional data parameter to when/watch callbacks 2015-05-19 18:49:38 -04:00
Daniel Lowrey
ca82ac5362 Fix NativeReactor bug breaking tick sleep timing 2015-05-19 16:13:53 -04:00
Daniel Lowrey
2a0486cb3c Add Amp\pipe() function to pipe eventual results through a functor 2015-05-19 11:31:01 -04:00
Daniel Lowrey
30245d6817 Add optional callback data param in Deferred::__construct() 2015-05-19 11:16:04 -04:00
Daniel Lowrey
953c4612e6 Future -> Deferred 2015-05-19 00:21:33 -04:00
Daniel Lowrey
3af013d418 Expose boolean AMP_DEBUG for performance tuning
Amp Future instances double both as Promisor and Promise
implementations when AMP_DEBUG is defined and set to false.
This switch allows private Promise resolution safety by
default at the expense of performance.

Amp applications should set AMP_DEBUG to false in production
environments to maximize performance.
2015-05-18 23:57:34 -04:00
Daniel Lowrey
0973bba5ef Add PromiseStream to stream Promise updates without callback hell 2015-05-18 17:39:09 -04:00