mirror of
https://github.com/danog/amp.git
synced 2025-01-22 05:11:42 +01:00
Reactor watcher option "callback_data" renamed "cb_data"
This commit is contained in:
parent
ff893fa784
commit
71f9687cff
@ -1,5 +1,6 @@
|
||||
### HEAD
|
||||
|
||||
- Reactor watcher option "callback_data" renamed "cb_data"
|
||||
- Combinator functions optimized for performance
|
||||
- Amp\reactor() now accepts an optional assignment parameter for
|
||||
modifying the global default event reactor instance to allow for
|
||||
|
@ -161,7 +161,7 @@ class LibeventReactor implements SignalReactor {
|
||||
$watcher->id = $watcherId;
|
||||
$watcher->type = $type;
|
||||
$watcher->callback = $callback;
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
|
||||
if ($type !== Watcher::IMMEDIATE) {
|
||||
|
@ -242,7 +242,7 @@ class NativeReactor implements Reactor {
|
||||
$watcher->id = $watcherId = $this->lastWatcherId++;
|
||||
$watcher->type = Watcher::IMMEDIATE;
|
||||
$watcher->callback = $callback;
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
|
||||
if ($watcher->isEnabled) {
|
||||
@ -268,7 +268,7 @@ class NativeReactor implements Reactor {
|
||||
$watcher->id = $watcherId = $this->lastWatcherId++;
|
||||
$watcher->type = Watcher::TIMER_ONCE;
|
||||
$watcher->callback = $callback;
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
$watcher->msDelay = round(($msDelay / 1000), 3);
|
||||
$watcher->nextExecutionAt = null;
|
||||
@ -303,7 +303,7 @@ class NativeReactor implements Reactor {
|
||||
$watcher->id = $watcherId = $this->lastWatcherId++;
|
||||
$watcher->type = Watcher::TIMER_REPEAT;
|
||||
$watcher->callback = $callback;
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
$watcher->msInterval = round(($msInterval / 1000), 3);
|
||||
$watcher->msDelay = round(($msDelay / 1000), 3);
|
||||
@ -345,7 +345,7 @@ class NativeReactor implements Reactor {
|
||||
$watcher->id = $watcherId = $this->lastWatcherId++;
|
||||
$watcher->type = $type;
|
||||
$watcher->callback = $callback;
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
$watcher->stream = $stream;
|
||||
$watcher->streamId = $streamId = (int) $stream;
|
||||
|
@ -152,7 +152,7 @@ class UvReactor implements SignalReactor {
|
||||
$watcher->id = $watcherId = $this->lastWatcherId++;
|
||||
$watcher->type = Watcher::IMMEDIATE;
|
||||
$watcher->callback = $callback;
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
|
||||
if ($watcher->isEnabled) {
|
||||
@ -199,7 +199,7 @@ class UvReactor implements SignalReactor {
|
||||
$watcher->type = ($isRepeating) ? Watcher::TIMER_ONCE : Watcher::TIMER_REPEAT;
|
||||
$watcher->uvHandle = uv_timer_init($this->loop);
|
||||
$watcher->callback = $this->wrapTimerCallback($watcher, $callback);
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
$watcher->msDelay = $msDelay;
|
||||
$watcher->msInterval = $isRepeating ? $msInterval : 0;
|
||||
@ -271,7 +271,7 @@ class UvReactor implements SignalReactor {
|
||||
$watcher->id = $watcherId;
|
||||
$watcher->type = $type;
|
||||
$watcher->callback = $callback;
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
$watcher->stream = $stream;
|
||||
$watcher->streamId = $streamId = (int) $stream;
|
||||
@ -367,7 +367,7 @@ class UvReactor implements SignalReactor {
|
||||
$watcher->id = $watcherId = $this->lastWatcherId++;
|
||||
$watcher->type = Watcher::SIGNAL;
|
||||
$watcher->callback = $this->wrapSignalCallback($watcher, $func);
|
||||
$watcher->callbackData = @$options["callback_data"];
|
||||
$watcher->callbackData = @$options["cb_data"];
|
||||
$watcher->isEnabled = isset($options["enable"]) ? (bool) $options["enable"] : true;
|
||||
$watcher->signo = $signo;
|
||||
$watcher->uvHandle = uv_signal_init($this->loop);
|
||||
|
@ -538,7 +538,7 @@ function __coroutineAdvance($cs) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cs->reactor->immediately("Amp\__coroutineNextTick", ["callback_data" => $cs]);
|
||||
$cs->reactor->immediately("Amp\__coroutineNextTick", ["cb_data" => $cs]);
|
||||
|
||||
} catch (\Exception $uncaught) {
|
||||
$cs->promisor->fail($uncaught);
|
||||
|
@ -375,7 +375,7 @@ abstract class ReactorTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
public function testOptionalCallbackDataPassedOnInvocation() {
|
||||
$callbackData = new \StdClass;
|
||||
$options = ["callback_data" => $callbackData];
|
||||
$options = ["cb_data" => $callbackData];
|
||||
$reactor = $this->getReactor();
|
||||
$reactor->immediately(function($reactor, $watcherId, $callbackData) {
|
||||
$callbackData->immediately = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user