Aaron Piotrowski
1929715b97
Remove driver nullability
2017-03-10 15:34:52 -06:00
Aaron Piotrowski
754a29e86c
Remove promise error handler
...
Exceptions thrown from when callbacks are now forwarded directly to the loop error handler.
2017-03-10 15:32:58 -06:00
Niklas Keller
be34c49a2d
Fixup all remaining issues, tests pass locally
2017-03-10 22:20:28 +01:00
Niklas Keller
dd8993b98e
Fix AsyncInterop → Amp in ErrorHandler
2017-03-10 22:09:49 +01:00
Niklas Keller
0be9ae9ade
Switch from AsyncInterop\Promise to Amp\Promise
2017-03-10 21:58:46 +01:00
Niklas Keller
e64bbfb9f5
Add Loop::set, auto-wrapping, fixup things
2017-03-10 21:31:57 +01:00
Niklas Keller
21561661a2
Fixup after repository merge
2017-03-10 19:19:32 +01:00
Niklas Keller
f4f9008ca0
Merge amphp/amp repository into amphp/amp
2017-03-10 18:26:17 +01:00
Aaron Piotrowski
72378e2b82
Add Amp\call()
2017-02-22 15:52:30 -06:00
Aaron Piotrowski
bb51720818
Always use persistent flag for timer
...
cancel() is called when delay timers are executed anyway, so it doesn't matter what the flags are for the event.
2017-02-16 23:39:11 -06:00
Aaron Piotrowski
9073f6c999
Docblock cleanup
2017-02-16 22:36:32 -06:00
Aaron Piotrowski
d7e8a9de84
Calling stop() in nested loop should not stop outer loop
2017-02-16 22:20:10 -06:00
Aaron Piotrowski
b72e504eab
Ensure correct argument order in multi-argument lift
2017-02-09 22:34:24 -06:00
Aaron Piotrowski
3861c6b5da
Simpler each and filter implementation
2017-02-09 22:17:45 -06:00
Aaron Piotrowski
5dade2443f
Fix error in Message with empty stream
2017-01-31 17:30:05 -06:00
Aaron Piotrowski
5f284b2f70
Refactor Message, add Iterator
2017-01-31 17:09:38 -06:00
Niklas Keller
a69bf4d3a0
Improve type hints / types
2017-01-16 17:39:24 +01:00
Aaron Piotrowski
0631560c65
Merge pull request #62 from amphp/drop-choose
...
Drop Amp\choose
2017-01-15 08:49:11 -06:00
Aaron Piotrowski
e3cb5dc385
Merge pull request #54 from amphp/ex-msg
...
Make exception messages more generic
2017-01-15 08:48:56 -06:00
Aaron Piotrowski
84917e7786
Add Message and Listener::getBuffered()
2017-01-13 18:46:32 -06:00
Aaron Piotrowski
df901a0305
Remove stream() method from Listener
2017-01-13 18:12:38 -06:00
Niklas Keller
8f245fa677
Drop Amp\choose
2017-01-13 19:09:17 +01:00
Aaron Piotrowski
a643f9a260
Remove last consumed value from listener before drain
2017-01-11 20:13:12 -06:00
Niklas Keller
6312ac15aa
Fix invalid watcher exception construction
2017-01-11 14:28:27 +01:00
Aaron Piotrowski
4c48037295
Add reference/unreference methods to Pause
2017-01-08 01:15:57 -06:00
Aaron Piotrowski
ae28eae552
Lazy → LazyPromise
2017-01-08 01:02:11 -06:00
Aaron Piotrowski
5ad1fdb38b
Add more Listener tests and kill another Humbug mutant
2017-01-08 00:22:07 -06:00
Niklas Keller
3b46c168a5
Improve tests and kill some Humbug mutants
2017-01-07 22:55:34 +01:00
Aaron Piotrowski
2976ebdbb5
Throw on consecutive calls to Listener::advance(); better property names
2017-01-07 12:31:36 -06:00
Aaron Piotrowski
cf5ebb1408
Better error message when emitting after resolve
2017-01-07 12:25:04 -06:00
Aaron Piotrowski
cba57dd81e
Simplify PrivatePromise and PrivateStream
2017-01-07 12:24:40 -06:00
Niklas Keller
ae69e92266
Update to promise 0.4.0 and event-loop 0.5.0, add humbug config
2017-01-07 13:47:45 +01:00
Niklas Keller
568183b261
Update to event-loop 0.5.0
2017-01-07 13:45:03 +01:00
Aaron Piotrowski
a47fc2bc01
Don't call uv_stop()
...
libuv will actually stop mid-tick, making the behavior inconsistent with the other loop implementations.
2017-01-06 10:50:05 -06:00
Aaron Piotrowski
e169bb649c
Remove unnecessary temp variable
2017-01-06 10:21:58 -06:00
Aaron Piotrowski
fbdc611e44
Activate watchers at begging of tick instead of end
2017-01-06 10:15:54 -06:00
Aaron Piotrowski
3e0cd85b67
Stop watchers in EvLoop::__destruct() to avoid segfault
2017-01-05 17:38:33 -06:00
Aaron Piotrowski
9706815714
Fix signals in multiple loops using event and ev extensions with epoll backend
2017-01-05 17:32:03 -06:00
Aaron Piotrowski
02c2fcf0fa
Add implementation using event extension
2017-01-05 14:08:33 -06:00
Aaron Piotrowski
06e50bdb88
Fix docblock
2017-01-05 12:39:34 -06:00
Aaron Piotrowski
80900189c9
Fix visibility of deactivate()
2017-01-05 12:39:10 -06:00
Aaron Piotrowski
9ff73ac681
Swap production and dev definitions for Deferred and Emitter
2017-01-04 10:24:51 -06:00
Aaron Piotrowski
210b6ff258
Observable → Stream
2017-01-03 19:10:27 -06:00
Aaron Piotrowski
a872f14fd4
Drop Amp\range(), add Amp\observableFromIterable()
2016-12-30 12:50:09 -06:00
Bob Weinand
26a707ed94
Always put the watcher back upon re-activation
2016-12-30 00:55:06 +01:00
Aaron Piotrowski
b5d5b8dff1
Drop loop wrapper functions
2016-12-29 16:57:08 -06:00
Aaron Piotrowski
5651240615
Update to promise spec v0.3
...
Dropped strict-types due to spec requiring weak types in callbacks.
2016-12-29 16:29:27 -06:00
Aaron Piotrowski
81f6d3f94f
Avoid pcntl bug with closures
2016-12-29 14:40:12 -06:00
Aaron Piotrowski
6f2a238087
Merge branch 'event-loop-v0.4' into uv
2016-12-28 23:50:30 -06:00
Aaron Piotrowski
b535a72161
Update for loop standard changes
2016-12-28 23:11:08 -06:00
Bob Weinand
04300eba89
Remove redundant destructor
2016-12-29 03:06:53 +01:00
Bob Weinand
7e875298b8
Use getInfo() in __debugInfo()
2016-12-29 01:50:41 +01:00
Aaron Piotrowski
8ab3918974
Remove \UV::RUN_ONCE if not blocking.
2016-12-28 16:16:09 -06:00
Aaron Piotrowski
225c0703ee
Merge branch 'event-loop-v0.4' into uv
2016-12-28 13:02:20 -06:00
Aaron Piotrowski
583a50fab7
Update for loop standard changes
2016-12-28 12:59:04 -06:00
Niklas Keller
2a65c0735b
Fix docblock for Placeholder::when
2016-12-23 23:48:24 +01:00
Bob Weinand
ef9216a00a
Do not block in Loop::dispatch() after Loop::stop()
2016-12-18 21:56:47 +01:00
Aaron Piotrowski
bc1ae1822c
Unreference watcher in Amp\timout()
2016-12-17 08:28:19 -06:00
Aaron Piotrowski
11f1c7e7c4
Amp\lazy() → Amp\Lazy
...
Plus some tests!
2016-12-15 18:50:33 -06:00
Aaron Piotrowski
93ad513ab1
Remove dead code
...
Deferred and Postponed will never throw from the functions they define.
2016-12-15 17:34:30 -06:00
Aaron Piotrowski
6e97e6630d
Fix some function bugs and add more tests
2016-12-15 17:31:57 -06:00
Niklas Keller
1bbcadaedd
Rename Observer::next to Observer::advance
2016-12-13 20:37:51 +01:00
Niklas Keller
1299e51ca6
Add tests for InvalidYieldError, improve key display
...
Without something like var_export, null and false are casted to an empty string.
2016-12-11 17:08:17 +01:00
Niklas Keller
e4d97caad7
Fix whitespace
2016-12-11 16:17:51 +01:00
Niklas Keller
2ba73e90fc
Fix documentation to point to when instead of then and done
2016-12-11 16:16:12 +01:00
Niklas Keller
bd7e84a138
Improve error messages
2016-12-11 16:12:42 +01:00
Daniel Lowrey
e3cdea2fce
Make exception messages more generic
2016-12-09 12:22:37 -05:00
Aaron Piotrowski
f95412770b
Lazy promise bugfix
2016-11-14 14:10:44 -06:00
Aaron Piotrowski
9927ad5b4f
Awaitable → Promise
2016-11-14 13:59:21 -06:00
Aaron Piotrowski
7f5142be88
Fix map() return type
2016-09-09 18:05:01 -05:00
Aaron Piotrowski
973a08c26b
Update for loop standard v0.3
2016-09-09 17:38:22 -05:00
Aaron Piotrowski
759af93112
Missed static; remove unused import
2016-09-07 12:24:49 -05:00
Aaron Piotrowski
0992eaea89
CallableFromMethod -> CallableMaker
2016-08-30 10:34:17 -05:00
Aaron Piotrowski
448391531e
Add CallableFromMethod trait
2016-08-29 18:35:49 -05:00
Aaron Piotrowski
220c969e12
Allow Amp\*() loop callbacks to return values
...
Asserting that the function be void if not a Generator turned out to be just annoying rather than helpful.
2016-08-29 12:40:13 -05:00
Aaron Piotrowski
44aee8de47
Restrict callback returns to void or Generator
2016-08-26 16:29:57 -05:00
Aaron Piotrowski
edf2984863
Update Observable-based functions
...
Some of the changes to Observables broke functions using them.
2016-08-23 13:22:24 -05:00
Aaron Piotrowski
f46912d387
Fix bug on null emits
2016-08-23 13:18:56 -05:00
Aaron Piotrowski
6e1c1db5a6
Drop special behavior when emitting an observable
2016-08-23 13:17:59 -05:00
Aaron Piotrowski
3ce0c0dd37
Resolve with boolean, not emitted value
2016-08-23 12:50:16 -05:00
Bob Weinand
c89f10eef0
Make Observer::drain() public
2016-08-23 16:21:05 +02:00
Aaron Piotrowski
5f1354bf1a
Add drain() method to Observer
2016-08-23 08:50:04 -05:00
Aaron Piotrowski
ddefcf21f9
Implement Observable in Success and Failure
2016-08-22 16:21:47 -05:00
Aaron Piotrowski
ef143534e3
Fix issue with resolved Observer not receiving all values
2016-08-22 10:54:39 -05:00
Aaron Piotrowski
96e1178b89
Code, docblock, and comment cleanup
2016-08-17 22:25:54 -05:00
Aaron Piotrowski
a8d7d71a1a
Drop Future and Producer
2016-08-17 21:17:31 -05:00
Aaron Piotrowski
d4e83490c2
Drop unsubscribing from Observable
2016-08-17 21:11:03 -05:00
Aaron Piotrowski
2317a3aa37
Unsubscribe from emitted observable if failed
2016-08-16 16:31:09 -05:00
Aaron Piotrowski
84c2572e0a
Prevent fail call after resolution
2016-08-16 13:30:32 -05:00
Aaron Piotrowski
bdc26e1e8b
Combine use statements
2016-08-16 13:07:51 -05:00
Aaron Piotrowski
dae4eb90da
Better Emitter fix; fail observable if emitted awaitable fails
2016-08-16 13:07:38 -05:00
Aaron Piotrowski
a8a5a1b3a5
Fix Emitter
2016-08-16 02:28:47 -05:00
Aaron Piotrowski
888229d667
Use strict types
2016-08-15 23:46:26 -05:00
Bob Weinand
6a87658ad8
Remove bogus .coveralls.yml file
2016-08-15 15:41:28 +02:00
Bob Weinand
e7d629e58f
Fix signals not being dispatched in NativeLoop
...
This was the case when at least one expired and non-expired timer existed.
2016-08-14 22:29:30 +02:00
Niklas Keller
cef92e9770
Doc fixes for Coroutine
2016-08-14 19:17:08 +02:00
Bob Weinand
dcf17e3f98
Optimize Producer & remove wait until first subscribe
...
Also delay first emit in Emitter until next tick
2016-08-14 16:57:17 +02:00
Bob Weinand
08d65bcd63
Make Subscriber not caring about $id type
2016-08-14 04:47:48 +02:00
Bob Weinand
80265b726e
Do not have final methods in Struct, functions may need to be overridden
2016-08-14 04:41:47 +02:00
Aaron Piotrowski
42d9b25c3d
Temp var unnecessary
2016-08-13 10:24:55 -05:00
Aaron Piotrowski
7bc08b9a6a
Replace leftover LogicExceptions exceptions with Error
2016-08-12 16:58:53 -05:00
Aaron Piotrowski
2ff32c2d6b
Remove unnecessary default parameter values
2016-08-12 16:38:36 -05:00
Aaron Piotrowski
66c38e1480
Refactor Amp\coroutine()
...
Any function can now be passed to this function, which now returns a function returning an awaitable.
2016-08-12 14:50:44 -05:00
Aaron Piotrowski
69ec812bc0
Require PHP 7
2016-08-11 14:52:40 -05:00
Aaron Piotrowski
658edf33f7
Use Closure::fromCallable() in 7.1
2016-08-11 13:33:51 -05:00
Aaron Piotrowski
ea66677a50
Update for Driver changes in spec
2016-08-06 08:58:37 -05:00
Aaron Piotrowski
aa7b76e842
Add awaitable/coroutine-aware loop functions
...
These functions mirror the standard loop methods, but run returned Generators as coroutines and invoke rethrow() on returned awaitables.
2016-08-02 12:48:32 -05:00
Aaron Piotrowski
13908fe2e5
Add concat() function
2016-08-01 11:10:59 -05:00
Aaron Piotrowski
9055f159e7
Revert some() to v1 behavior
2016-07-31 00:31:04 -05:00
Aaron Piotrowski
19e6440897
Fix native loop timers
2016-07-25 10:09:40 -05:00
Aaron Piotrowski
c2caca9d02
Fix functions using Subscriber as Awaitable
...
Use PHP_INT_MAX instead of 0 for infinite interval() count.
2016-07-20 08:53:18 -05:00
Aaron Piotrowski
7adc7d8452
Remove missed emit() default value
2016-07-20 08:52:19 -05:00
Aaron Piotrowski
8e794ba1d7
Fix stream()
2016-07-19 15:24:05 -05:00
Aaron Piotrowski
24142496d8
Rethrow subscriber callback exceptions from loop
2016-07-19 15:13:56 -05:00
Bob Weinand
1642bf9195
s/settle/any/ which now returns [$errors, $succeeds]
2016-07-19 21:39:09 +02:00
Aaron Piotrowski
bec838b693
Remove leftover exception class
...
No longer needed as Subscriber is not an awaitable.
2016-07-19 13:30:28 -05:00
Aaron Piotrowski
70123b9a44
Update Producer::resolve(); fix emitting observable
2016-07-19 13:19:44 -05:00
Aaron Piotrowski
9839343bbb
Remove default value from emit
2016-07-19 13:10:15 -05:00
Aaron Piotrowski
13a6fc59c4
Producer::init() -> private
2016-07-19 12:42:58 -05:00
Aaron Piotrowski
32b4721c5e
Subscriber no longer implements Awaitable
2016-07-19 12:40:16 -05:00
Aaron Piotrowski
90d744537e
protected -> private in internal traits
2016-07-19 12:32:43 -05:00
Aaron Piotrowski
3e170639c3
Remove final from Observer and Subscriber
2016-07-19 11:58:20 -05:00
Aaron Piotrowski
dad93a6da0
Merge branch 'observable' into v2
2016-07-18 23:29:19 -05:00
Aaron Piotrowski
b9d554dd7b
Add more functions
2016-07-18 23:23:25 -05:00
Aaron Piotrowski
c561197d1d
Remove unused v1 files
2016-07-18 23:22:07 -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
Bob Weinand
3603d5b1ec
EvLoop::enabled() -> supported()
2016-06-26 17:35:25 +02:00
Aaron Piotrowski
2a1fde0b44
Add automatic loop factory bootstrap
2016-06-23 23:37:06 -05:00
Aaron Piotrowski
4ed8e65468
Cleaner resolution
2016-06-16 23:27:14 -05:00
Aaron Piotrowski
92767755ee
Avoid loosing exception thrown from generator after invalid yield
2016-06-16 22:44:32 -05:00
Aaron Piotrowski
f553e4f08b
Improve coroutine continuation
...
Duplicated some code for faster coroutine continuation.
2016-06-14 23:26:59 -05:00
Aaron Piotrowski
ae182165e5
Remove circular reference check
2016-06-14 21:53:50 -05:00
Aaron Piotrowski
60d560d70e
Add $className param to capture(); other cleanup
2016-06-14 21:40:04 -05:00
Aaron Piotrowski
986b69907f
No need to call keepalive within EvLoop
...
Loop class handles the details necessary to stop the loop if no reference watchers exist.
2016-06-09 12:59:18 -05:00
Aaron Piotrowski
33338324d4
Add UvLoop
2016-06-09 12:57:46 -05:00
Aaron Piotrowski
666cc42a5f
Better ref/unref in EvLoop; fix EvLoopTest
2016-06-08 16:03:37 -05:00
Aaron Piotrowski
543d1c5e66
Fix repeat timer interval
2016-06-08 12:08:00 -05:00
Aaron Piotrowski
a49d333f1b
Add EvLoop; Split shared components into Loop
2016-06-08 09:22:14 -05:00
Aaron Piotrowski
757778c848
Fix check if signal was disabled
...
Plus some minor tweaks
2016-06-08 00:15:36 -05:00
Aaron Piotrowski
8e31310921
Fix repeat timer memory leak
2016-06-07 12:40:35 -05:00
Aaron Piotrowski
93424c1c6e
Enable events in next tick
2016-06-07 12:24:53 -05:00
Aaron Piotrowski
f940934a0b
Update for latest standard changes
...
Plus some minor tweaks and more docs.
2016-06-07 00:18:59 -05:00
Bob Weinand
c9af067b46
Fix delays/intervals being able equal to zero
2016-06-04 00:10:47 +02:00
Aaron Piotrowski
666bb332e1
Fix some bugs, refactor disable/unreference
2016-06-03 10:00:29 -05:00
Aaron Piotrowski
808ce32e3c
Fix leftover mentions of Disposable
2016-06-02 17:11:25 -05:00
Aaron Piotrowski
548a9fd556
Fix bug when emitting failed awaitable and waiting for a subscriber
2016-06-02 17:05:22 -05:00
Aaron Piotrowski
7fb57141d2
Cleanup yielded value handling
2016-06-02 10:46:22 -05:00
Aaron Piotrowski
5715bec9e1
Refactor functions with Emitter
2016-06-02 10:43:46 -05:00
Aaron Piotrowski
cef5c90168
Drop disposable interface; rename dispose() to unsubscribe()
2016-06-02 10:42:22 -05:00
Aaron Piotrowski
acbe2c8237
Add Registry; support streams with multiple watchers
2016-06-02 09:45:04 -05:00
Aaron Piotrowski
055d7d4c52
Update docblocks
2016-06-01 12:18:11 -05:00
Aaron Piotrowski
cd6939db5a
Build awaitable in when()
2016-06-01 12:10:46 -05:00
Aaron Piotrowski
b705c144c6
Minor tweaks
2016-06-01 12:06:43 -05:00
Aaron Piotrowski
906d6db47a
Update docblocks
2016-06-01 11:37:12 -05:00
Aaron Piotrowski
c4e9a19095
Rename Emitter to Producer; add new Emitter class
...
Emitter uses a coroutine to emit values. Updated examples.
2016-06-01 11:19:19 -05:00
Aaron Piotrowski
cc431a0374
Prevent emit without subscribers
2016-05-31 23:02:59 -05:00
Aaron Piotrowski
eb49e6e8ff
Resolve emit with observable result instead of emitting
...
Emitting another observable will emit values from the emitted observable, then resolve the awaitable returned from emit with the observable result
2016-05-31 16:23:01 -05:00
Aaron Piotrowski
a52e1e4c33
Rename Observer methods
2016-05-31 14:45:14 -05:00
Aaron Piotrowski
1b079bb336
Fix Observer
2016-05-30 00:34:44 -05:00
Aaron Piotrowski
57e25f9354
Simpler implementation
2016-05-29 11:46:58 -05:00
Aaron Piotrowski
da3bbdf90c
Null default for Success
2016-05-29 10:40:00 -05:00
Aaron Piotrowski
4a2baa670e
Subscriber model
2016-05-27 15:44:01 -05:00
Aaron Piotrowski
ca827319ec
Standard updates and more
...
Update for changes in async-interop/event-loop.
Do not invalidate delay and defer on disable.
Better watcher ID generation.
Throw if enabling invalid watcher.
2016-05-27 10:16:36 -05:00
Aaron Piotrowski
99eecc1a3f
Refactor
2016-05-26 18:20:05 -05:00
Aaron Piotrowski
3edab2dfd3
Put Loop::get() back
...
Why do I keep thinking null uses the current loop... bah
2016-05-26 18:15:33 -05:00
Aaron Piotrowski
dd70850682
Remove driver argument
2016-05-26 00:09:50 -05:00
Aaron Piotrowski
ae225835f2
Drop exception namespace
2016-05-25 23:24:06 -05:00
Aaron Piotrowski
a68bde6449
Eliminate watcher constructors
2016-05-25 23:21:49 -05:00
Aaron Piotrowski
b436a56869
Remove unused property
2016-05-24 12:09:52 -05:00
Aaron Piotrowski
a9362780ed
Initial commit
2016-05-24 11:47:14 -05:00
Aaron Piotrowski
ccec7acc94
Remove Exception namespace
2016-05-24 10:39:19 -05:00
Aaron Piotrowski
5cd2c33d5c
Fix defer queue invocation
2016-05-24 09:36:16 -05:00
Aaron Piotrowski
6d263ffb84
Drop Awaitable from namespace
2016-05-23 22:48:28 -05:00
Aaron Piotrowski
8b42994ec9
Fix exception creation
2016-05-23 21:36:29 -05:00
Aaron Piotrowski
13e807d564
Throw on repeated resolution
2016-05-23 21:32:41 -05:00
Aaron Piotrowski
6fc6ad1ab5
Throw instead of returning Failure object
2016-05-23 10:19:48 -05:00
Aaron Piotrowski
28577cf6e6
Add Pause; update for timer watcher changes in loop
2016-05-23 00:44:35 -05:00
Aaron Piotrowski
27a4569b8b
Improve defer queue invocation
2016-05-23 00:37:56 -05:00
Aaron Piotrowski
e1a2e99ca8
Avoid namespace lookup on built-in functions
2016-05-22 23:08:31 -05:00
Aaron Piotrowski
55e0971be1
Update for changes in async-interop
...
Remove use of Registry; switch Yoda conditionals
2016-05-22 22:59:09 -05:00
Aaron Piotrowski
378990fe86
Use $exception instead of passing as callback data
...
Less code this way
2016-05-22 13:43:37 -05:00
Aaron Piotrowski
918e792093
Fix LazyAwaitable
2016-05-22 13:42:38 -05:00
Aaron Piotrowski
b572f9be40
Rename and move Promise
2016-05-22 13:26:53 -05:00
Aaron Piotrowski
de3ada9014
Cleanup functions; rename any() to first(); remove resolve()
2016-05-22 10:53:13 -05:00
Aaron Piotrowski
b4ea37576e
Execute after CoroutineResult
2016-05-22 09:25:40 -05:00
Niklas Keller
0b954b2515
Fix wait to reuse current default loop
2016-05-22 10:57:31 +02:00
Niklas Keller
9f4d38471d
Remove 'fail', clean up signatures
2016-05-22 10:57:10 +02:00
Aaron Piotrowski
1864b3cbe6
Refactor coroutine return for 5.x
2016-05-22 00:11:03 -05:00
Aaron Piotrowski
9c541b0faa
Rename Lazy to LazyAwaitable
2016-05-21 23:47:50 -05:00
Aaron Piotrowski
a6fbc13d89
Remove defined check
2016-05-21 12:19:48 -05:00
Aaron Piotrowski
345bf78ac2
Double-quote strings
2016-05-21 12:12:55 -05:00
Aaron Piotrowski
a309a243c2
Fix formatting
2016-05-21 12:07:08 -05:00
Aaron Piotrowski
c7f64ce2c0
Initial commit
2016-05-21 09:44:52 -05:00
Aaron Piotrowski
deb45e2cc2
Initial commit
2016-05-19 11:13:07 -05: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
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
Daniel Lowrey
48d8aaf0e5
Correctly clear UvReactor once() watchers
2015-05-31 12:06:25 -04:00
Daniel Lowrey
31f21da9e9
Improve Deferred performance switching
2015-05-27 22:03:08 -04:00
Daniel Lowrey
0c4f04c6ab
Fix missing parameter if coroutine invoked without args
2015-05-27 18:33:57 -04:00
Bob Weinand
6c440b2797
Fix fatal error upon wrong key type
2015-05-27 23:36:22 +02:00
Daniel Lowrey
05e3ecc423
Fix bug incorrectly clearing repeat watcher when disabled
2015-05-26 03:03:32 -04:00
Daniel Lowrey
5e7d6ff095
Fix coroutine fatal if initial advance errored
2015-05-25 12:51:50 -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
35a601964e
don't use 0b constant values because bitwise comparisons aren't used
2015-05-20 21:28:34 -04:00
Daniel Lowrey
e8ac57db31
make function name consistent with others
2015-05-20 20:09:30 -04:00
Daniel Lowrey
29cde175b3
Minor coroutine resolution updates
2015-05-20 19:51:03 -04:00
Daniel Lowrey
c86d6cc930
don't swallow caught exception
2015-05-20 18:29:45 -04:00
Daniel Lowrey
0255049bbb
Don't use php7 ReflectionGenerator in PHP5.x branch
2015-05-20 18:19:23 -04:00
Daniel Lowrey
e6f1386b31
Fix double promisor resolve under error condition
2015-05-20 18:16:42 -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
9fa6010f19
Optimize non-promise pipe() case
2015-05-19 23:12:32 -04:00
Daniel Lowrey
c8d6a0b5b3
Optimize coroutine resolution for performance
2015-05-19 23:07:29 -04:00
Daniel Lowrey
fc600d46ab
Pass optional data parameter to when/watch callbacks
2015-05-19 18:49:38 -04:00
Daniel Lowrey
879b1229d1
Minor PromiseStream fixes
2015-05-19 16:20:53 -04:00
Daniel Lowrey
ca82ac5362
Fix NativeReactor bug breaking tick sleep timing
2015-05-19 16:13:53 -04:00
Daniel Lowrey
44d52cdf2f
Rename AMP_DEBUG -> AMP_PRODUCTION_MODE
2015-05-19 14:56:22 -04:00
Daniel Lowrey
de905a6104
Correct Pause implementation for use with new trait system
2015-05-19 14:10:53 -04:00
Daniel Lowrey
7e16326871
remove scalar typehint from 5.x-compatible code
2015-05-19 14:05:41 -04:00
Daniel Lowrey
e3e01c993c
Add Amp\Streamable interface for buffered generator resolution
2015-05-19 12:03:26 -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
1ed5e69c52
Move buffering to PromiseStream for custom behavior in extended instances
2015-05-19 01:09:23 -04:00
Daniel Lowrey
68719d8023
Unresolved -> PrivatePlaceholder
2015-05-19 00:29:27 -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
Daniel Lowrey
02e85b29c6
Fix high cpu usage in timer loop from broken "nextTimerAt" caching
2015-05-18 11:40:09 -04:00
Daniel Lowrey
aa27ab7a10
Fixed bug causing every NativeReactor tick to last one second (lol)
2015-05-17 19:52:41 -04:00
Daniel Lowrey
631a6089d9
Resolve correct Success arg in empty any\(\) combinator
2015-05-15 15:59:57 -04:00
Daniel Lowrey
93eb8ad8de
Suggest nearby property name in Struct error messages
2015-05-13 10:05:56 -04:00
Daniel Lowrey
2c3a3e65bd
Add offending generator key to coroutine resolution error messages
2015-05-13 01:15:35 -04:00
Daniel Lowrey
4a45502ae9
Correctly update nextTimerAt timestamp for repeat watchers
2015-05-10 02:36:39 -04:00
Daniel Lowrey
ed6084c333
Fix incorrect additional increment
2015-05-10 00:54:02 -04:00
Daniel Lowrey
cddb8e9f08
Backport API changes to 5.5+ compat
2015-05-04 12:48:29 -04:00
Daniel Lowrey
b9819d85b4
kill reference to removed function
2015-04-29 13:45:06 -04:00
Daniel Lowrey
06981ab6ea
fix bad anon class syntax
2015-04-29 11:24:26 -04:00
Daniel Lowrey
1565e23d46
replace call_user_func() reference
2015-04-27 14:33:41 -04:00
Daniel Lowrey
7cb09edf29
Use anonymous classes
2015-04-27 14:33:17 -04:00
Daniel Lowrey
446eded441
Remove superfluous parameter
2015-04-27 14:30:07 -04:00
Daniel Lowrey
60f1b4484e
update docblock
2015-04-03 12:52:17 -04:00
Daniel Lowrey
812e1fb6b4
Reactor API updates, NativeReactor refactor
2015-04-03 11:56:16 -04:00
Daniel Lowrey
2aa4c0c357
Remove libevent reactor until pecl/libevent supports php7
2015-04-03 11:55:23 -04:00
Daniel Lowrey
b57f6eb6bf
Add explanatory comment
2015-03-28 10:05:09 -04:00
Daniel Lowrey
fa080b66aa
Remove superfluous is_object() check
2015-03-28 10:03:27 -04:00
Daniel Lowrey
9a1581c91d
Bind local vars to closure
2015-03-25 14:17:26 -04:00
Daniel Lowrey
654e82f277
minor cleanup
2015-03-23 11:07:40 -04:00
Daniel Lowrey
6375cdd522
Minor documentation rewording
2015-03-19 12:01:09 -04:00
Daniel Lowrey
abd5d34d92
Remove deprecated ReactorFactory
2015-03-19 11:59:20 -04:00
Daniel Lowrey
203855d22c
minor docblock update
2015-03-19 11:39:57 -04:00
Daniel Lowrey
d1b919d9fc
Avoid extra Closure instantiation in PrivateFuture
2015-03-19 11:39:38 -04:00
Daniel Lowrey
68185a6cf1
Promisor::update() now accepts variadic args
2015-03-19 11:26:56 -04:00
Daniel Lowrey
cd84401b6f
Remove superfluous Reactor::at() method
2015-03-19 11:19:19 -04:00
Daniel Lowrey
af2335cf50
Remove deprecated wait functionality
2015-03-19 11:17:50 -04:00
Daniel Lowrey
16be668192
Add scalar types, update docblocks
2015-03-19 11:15:07 -04:00
Daniel Lowrey
620f798b13
Add new Pause promise
2015-03-18 14:05:27 -04:00
Daniel Lowrey
2e1ef0b739
Implement Closure::call()
2015-03-16 15:03:52 -04:00
Daniel Lowrey
834255163c
Refactor coroutine functionality
2015-03-16 15:00:17 -04:00
Daniel Lowrey
a573e195a6
Allow null implicit yields
2015-02-18 09:53:55 -05:00
Daniel Lowrey
24acba4486
Merge branch 'psr' of https://github.com/lyrixx/amp into lyrixx-psr
2015-02-05 23:54:12 -05:00
Grégoire Pineau
01d50d10f9
Fixex typos
2015-02-05 18:17:05 +01:00
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
7e451251ab
Make Amp\Struct abstract to better represent its purpose
2015-01-28 22:30:02 -05:00