當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。