1
0
mirror of https://github.com/danog/amp.git synced 2025-01-22 13:21:16 +01:00

Fix native loop timers

This commit is contained in:
Aaron Piotrowski 2016-07-25 10:09:40 -05:00
parent 3603d5b1ec
commit 19e6440897

View File

@ -214,10 +214,9 @@ class NativeLoop extends Loop {
case Watcher::DELAY:
case Watcher::REPEAT:
$priority = (\microtime(true) * self::MILLISEC_PER_SEC) + $watcher->value;
$expiration = (int) $priority;
$expiration = (int) (\microtime(true) * self::MILLISEC_PER_SEC) + $watcher->value;
$this->timerExpires[$watcher->id] = $expiration;
$this->timerQueue->insert([$watcher, $expiration], -$priority);
$this->timerQueue->insert([$watcher, $expiration], -$expiration);
break;
case Watcher::SIGNAL:
@ -231,8 +230,7 @@ class NativeLoop extends Loop {
$callback = $watcher->callback;
$callback($watcher->id, $signo, $watcher->data);
}
})
) {
})) {
throw new \RuntimeException("Failed to register signal handler");
}
}