当前位置: 首页>>代码示例>>PHP>>正文


PHP LoopInterface::futureTick方法代码示例

本文整理汇总了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);
     });
 }
开发者ID:voidcontext,项目名称:filesystem,代码行数:11,代码来源:QueuedInvoker.php

示例2: startUpdates

 private function startUpdates()
 {
     if (!$this->updateQueue->isEmpty()) {
         $this->updating = true;
         $this->loop->futureTick([$this, 'update']);
     }
 }
开发者ID:tsufeki,项目名称:phpcmplr,代码行数:7,代码来源:Indexer.php

示例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);
     });
 }
开发者ID:WyriHaximus,项目名称:reactphp-event-loop-inspector,代码行数:15,代码来源:LoopDecorator.php

示例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();
 }
开发者ID:voidcontext,项目名称:filesystem,代码行数:15,代码来源:Adapter.php

示例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();
 }
开发者ID:smileytechguy,项目名称:nLine,代码行数:10,代码来源:AbstractLoopTest.php

示例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;
 }
开发者ID:vantt,项目名称:short-flake,代码行数:18,代码来源:IdGenerator.php

示例7: queueTick

 protected function queueTick()
 {
     $this->loop->futureTick([$this, 'tick']);
 }
开发者ID:WyriHaximus,项目名称:reactphp-psr7-stream-converter,代码行数:4,代码来源:PSR7ToReactStream.php

示例8: deregisterRpc

 protected function deregisterRpc()
 {
     $this->loop->futureTick(function () {
         $this->messenger->deregisterRpc(MessengerFactory::PROCESS_REGISTER);
     });
 }
开发者ID:phpCedu,项目名称:reactphp-child-process-messenger,代码行数:6,代码来源:Process.php

示例9: resolveResponse

 protected function resolveResponse($response)
 {
     $this->loop->futureTick(function () use($response) {
         $this->deferred->resolve($response);
     });
 }
开发者ID:wyrihaximus,项目名称:react-guzzle-http-client,代码行数:6,代码来源:Request.php


注:本文中的React\EventLoop\LoopInterface::futureTick方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。