Example #1
0
 private static function registerLoopRunner()
 {
     $hasBeenRun = false;
     register_shutdown_function(function () use(&$hasBeenRun) {
         if (!$hasBeenRun) {
             EventLoop::getLoop()->run();
         }
     });
     static::$loop->nextTick(function () use(&$hasBeenRun) {
         $hasBeenRun = true;
     });
 }