本文整理汇总了PHP中React\EventLoop\LoopInterface::futureTick方法的典型用法代码示例。如果您正苦于以下问题:PHP LoopInterface::futureTick方法的具体用法?PHP LoopInterface::futureTick怎么用?PHP LoopInterface::futureTick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类React\EventLoop\LoopInterface
的用法示例。
在下文中一共展示了LoopInterface::futureTick方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processQueue
protected function processQueue()
{
$this->loop->futureTick(function () {
if ($this->callQueue->isEmpty()) {
return;
}
$message = $this->callQueue->dequeue();
$data = ['function' => $message->getFunction(), 'args' => $message->getArgs(), 'errorResultCode' => $message->getErrorResultCode()];
$message->getDeferred()->resolve($data);
});
}
示例2: startUpdates
private function startUpdates()
{
if (!$this->updateQueue->isEmpty()) {
$this->updating = true;
$this->loop->futureTick([$this, 'update']);
}
}
示例3: futureTick
/**
* Schedule a callback to be invoked on a future tick of the event loop.
*
* Callbacks are guaranteed to be executed in the order they are enqueued.
*
* @param callable $listener The callback to invoke.
*/
public function futureTick(callable $listener)
{
$this->emit('futureTick', [$listener]);
return $this->loop->futureTick(function (LoopInterface $loop) use($listener) {
$this->emit('futureTickTick', [$listener]);
$listener($this);
});
}
示例4: callFilesystem
/**
* @param string $function
* @param array $args
* @param int $errorResultCode
* @return \React\Promise\Promise
*/
public function callFilesystem($function, $args, $errorResultCode = -1)
{
$deferred = new Deferred();
// Run this in a future tick to make sure all EIO calls are run within the loop
$this->loop->futureTick(function () use($function, $args, $errorResultCode, $deferred) {
$this->executeDelayedCall($function, $args, $errorResultCode, $deferred);
});
return $deferred->promise();
}
示例5: testFutureTickEventGeneratedByTimer
public function testFutureTickEventGeneratedByTimer()
{
$this->loop->addTimer(0.001, function () {
$this->loop->futureTick(function () {
echo 'future-tick' . PHP_EOL;
});
});
$this->expectOutputString('future-tick' . PHP_EOL);
$this->loop->run();
}
示例6: doCompute
/**
* @param Deferred $deferred
*
* @return \Closure
*/
private function doCompute(Deferred $deferred)
{
$fnc = function () use($deferred) {
// if we still have enough id in this epoc, compute it
if ($this->incremental < 4096) {
$deferred->resolve($this->current_epoc << 22 | $this->generator_id << 12 | $this->incremental++);
} else {
$this->loop->futureTick($this->doCompute($deferred));
}
};
$fnc->bindTo($this);
return $fnc;
}
示例7: queueTick
protected function queueTick()
{
$this->loop->futureTick([$this, 'tick']);
}
示例8: deregisterRpc
protected function deregisterRpc()
{
$this->loop->futureTick(function () {
$this->messenger->deregisterRpc(MessengerFactory::PROCESS_REGISTER);
});
}
示例9: resolveResponse
protected function resolveResponse($response)
{
$this->loop->futureTick(function () use($response) {
$this->deferred->resolve($response);
});
}