本文整理汇总了PHP中React\EventLoop\LoopInterface::isTimerActive方法的典型用法代码示例。如果您正苦于以下问题:PHP LoopInterface::isTimerActive方法的具体用法?PHP LoopInterface::isTimerActive怎么用?PHP LoopInterface::isTimerActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类React\EventLoop\LoopInterface
的用法示例。
在下文中一共展示了LoopInterface::isTimerActive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isPeriodicTimerActive
/**
* @param string $name
*
* @return bool
*/
public function isPeriodicTimerActive($name)
{
$tid = $this->getTid($name);
if (!isset($this->registry[$tid])) {
return false;
}
return $this->loop->isTimerActive($this->registry[$tid]);
}
示例2: isPeriodicTimerActive
/**
* @param TopicInterface $topic
* @param string $name
*
* @return bool
*/
public function isPeriodicTimerActive(TopicInterface $topic, $name)
{
$namespace = spl_object_hash($topic);
if (!isset($this->registry[$namespace][$name])) {
return false;
}
return $this->loop->isTimerActive($this->registry[$namespace][$name]);
}
示例3: queueRpc
/**
* @param Rpc $message
* @return PromiseInterface
*/
protected function queueRpc(Rpc $message)
{
$deferred = new Deferred();
$this->callQueue->enqueue($deferred);
if ($this->timer === null || !$this->loop->isTimerActive($this->timer)) {
$this->timer = $this->loop->addTimer(static::INTERVAL, function () {
$this->checkQueue();
});
}
return $deferred->promise()->then(function () use($message) {
return $this->sendRpc($message);
});
}
示例4: onEnd
/**
*
*/
protected function onEnd()
{
if ($this->requestTimer !== null && $this->loop->isTimerActive($this->requestTimer)) {
$this->loop->cancelTimer($this->requestTimer);
}
if ($this->connectionTimer !== null && $this->loop->isTimerActive($this->connectionTimer)) {
$this->loop->cancelTimer($this->connectionTimer);
}
$this->loop->futureTick(function () {
if ($this->httpResponse === null) {
$this->deferred->reject($this->error);
}
});
}
示例5: closure
/**
* @param Server $server
* @param LoopInterface $loop
*/
protected function closure(Server $server, LoopInterface $loop)
{
$this->logger->notice('Stopping server ...');
foreach ($this->serverPushHandlerRegistry->getPushers() as $handler) {
$handler->close();
$this->logger->info(sprintf('Stop %s push handler', $handler->getName()));
}
$server->emit('end');
$server->shutdown();
foreach ($this->periodicRegistry->getPeriodics() as $periodic) {
if ($periodic instanceof TimerInterface && $loop->isTimerActive($periodic)) {
$loop->cancelTimer($periodic);
}
}
$loop->stop();
$this->logger->notice('Server stopped !');
}
示例6: isTimerActive
/**
* Check if a given timer is active.
*
* @param TimerInterface $timer The timer to check.
*
* @return boolean True if the timer is still enqueued for execution.
*/
public function isTimerActive(TimerInterface $timer)
{
return $this->loop->isTimerActive($timer);
}