1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 12:35:02 +01:00
Commit Graph

38 Commits

Author SHA1 Message Date
Daniel Lowrey
99e38762a7 - Added Reactor::coroutine() method
- Added `Amp\coroutine()` function
- `YieldCommands` "enum" constant class removed -- yield keys now live in
  the reactor class
- New optional `"coroutine"` yield key for self-documenting generator
  yields.
- New optional `"async"` yield key for self-documenting promise yields.
- New `"return"` yield key for specifying the return value of a resolved
  Generator coroutine. If not specified a resolved coroutine result is
  equal to null.
- The final value yielded by a resolved `Generator` is *no longer* used
  as its "return" value. Instead, generators must manually use the new
  `"return"` yield key specifically to designate the value that should
  be used to resolve the promise associated with generator resolution.
- `GeneratorResolver` trait renamed to `CoroutineResolver` and is now an
  abstract class extended by the various `Reactor` implementations.
- Implicit "all" array combinator resolution is now removed. Use the
  explicit form instead:

```php
function() {
    list($a, $b, $c) = (yield 'all' => [$promise1, $promise2, $promise3]);
};
```
2015-02-03 19:41:15 -05:00
Daniel Lowrey
ab89cb1595 Remove unused variable 2015-01-21 20:19:47 -05:00
Daniel Lowrey
fb60221dcd Correctly re-enable stream polls in UvReactor 2015-01-21 20:16:33 -05:00
Bob Weinand
2ff42636aa Fix waiting for immediates resolution
If there are immediates generated in immediates, they have to wait until next tick - which may only be triggered in far future or never, depending on if there are other read/writeWatchers or timers So, now just do a single event run without blocking if there are new immediates generated during immediates execution
2015-01-21 21:39:12 +01:00
Daniel Lowrey
9edef1d5a7 Fix UvReactor notices 2015-01-18 20:13:08 -05:00
Douglas G.R
cf3e13a595 Throws a RuntimeException if php-uv or libevent is not loaded.
Using UvReactor or LibeventReactor directly (instead of Amp\getReactor)
doesn't check if php-uv/libevent is loaded and dies with a 'Call to undefined
function' message.
2015-01-06 00:01:07 -02:00
Daniel Lowrey
bbfca9f7ac Avoid unnecessary uv_timer_stop() when cleaning up once timers 2014-12-05 00:09:47 -05:00
Daniel Lowrey
dd1cbf8ca1 Merge branch 'debugInfo'
Conflicts:
	lib/LibeventReactor.php
	lib/NativeReactor.php
	lib/UvReactor.php
2014-12-02 01:06:36 -05:00
Daniel Lowrey
14c209012c Add Reactor::__debugInfo() for easier debugging 2014-12-02 00:45:12 -05:00
Daniel Lowrey
0d7ab5fc6c Add Reactor::onError, correctly exit extension reactor loops, replace resolve function with trait 2014-12-01 18:12:26 -05:00
Daniel Lowrey
1480eecaba Remove newloop protection from UvReactor 2014-12-01 15:39:57 -05:00
Daniel Lowrey
f686691892 Add Reactor::tick() 2014-11-26 15:53:18 -05:00
Daniel Lowrey
c75a8514a1 Reactor is now optional for combinator functions 2014-11-25 12:46:29 -05:00
Daniel Lowrey
1cb293b776 Remove Combinator/Resolver in favor of functions
This commit removes the Combinator and Resolver classes altogether.
The relevant functionality is now concentrated entirely in the
analogous functions:

- all()
- some()
- any()
- first()
- map()
- filter()
- resolve()

Additionally, all Promisor implementations now *require* a Reactor
upon instantiation. Previously this parameter could be null and the
static singleton reactor instance would be used automatically.
2014-11-24 23:14:07 -05:00
Daniel Lowrey
398c1a6790 Don't hammer the CPU with NOWAIT ticks 2014-11-18 10:08:34 -05:00
Daniel Lowrey
2d5a1eb643 Allow multiple IO watchers on a stream without borking libuv 2014-11-18 10:08:34 -05:00
Daniel Lowrey
ccc0bdcbe0 Remove unused Reactor constants 2014-11-18 10:08:34 -05:00
Daniel Lowrey
2a84f46853 Fix breakage if ext/openssl missing in windows 2014-11-18 10:08:34 -05:00
Daniel Lowrey
c28e143828 Remove watchStream() ... aliases are bad 2014-11-05 11:50:46 -05:00
Daniel Lowrey
634d978aeb Simplify reactor onStart() callback invocation 2014-10-22 18:14:01 -04:00
Daniel Lowrey
7064ec5dc8 Migrate repo to amphp/amp 2014-09-23 00:06:03 -04:00
Daniel Lowrey
56e720cd50 Merge concurrency primitives 2014-09-22 22:21:22 -04:00
Daniel Lowrey
df47c6f09b Use string watcher IDs 2014-08-22 14:08:31 -04:00
Daniel Lowrey
1f2420c80c Allow access to underlying php-uv loop resource 2014-08-19 14:20:04 -04:00
Daniel Lowrey
c7c5b0ba8f Standardize all watcher invocation params to: func($reactor, $watcherId, $data) 2014-08-09 10:30:32 -04:00
Daniel Lowrey
92f1ae05f5 Use writability hack to improve zero-delay repeating UV watchers 2014-08-08 17:08:28 -04:00
Daniel Lowrey
609cc2ddfe Always use fresh call stack for immediatelies in UvReactor 2014-08-08 16:39:11 -04:00
Daniel Lowrey
1aa1778401 Don't invoke onStart callback in UvReactor::run() when empty 2014-08-08 14:15:23 -04:00
Daniel Lowrey
2dfc44e548 Reactor::at() now accepts unix timestamp as well as strtotime() parsable string 2014-08-06 21:29:08 -04:00
Daniel Lowrey
ba70840e8b Update documentation 2014-08-06 16:01:24 -04:00
Daniel Lowrey
75e43cdcf8 Reorder Reactor::watchStream() params 2014-08-06 15:52:43 -04:00
Daniel Lowrey
f040981bdf Fixed bad callback declaration in UvReactor::onSignal watchers 2014-08-06 14:33:27 -04:00
Daniel Lowrey
0dfac49cd2 Fix minor screwups, normalize casing, etc 2014-08-06 14:26:03 -04:00
Daniel Lowrey
15b7b4ad80 Add UvReactor signal handling support 2014-08-06 00:32:13 -04:00
Daniel Lowrey
b375f048d4 Fix UvReactor memory leak where one-time watchers were never cleared 2014-08-06 00:25:47 -04:00
Daniel Lowrey
5878430a0c Update Reactor WATCH constants, remove Reactor::POLL_SOCK 2014-08-06 00:25:47 -04:00
Daniel Lowrey
d5b6266a82 Pass Reactor instance to onStart callbacks 2014-07-18 16:56:02 -04:00
Daniel Lowrey
bbd2ca2075 Add libuv php-uv event reactor 2014-06-11 12:33:15 -04:00