isRunning() public method

Check if loop is currently running.
public isRunning ( ) : boolean
return boolean
 /**
  * Flush the callback queue.
  *
  * Invokes callbacks which were on the queue when tick() was called and newly added ones.
  */
 public function tick()
 {
     while (!$this->queue->isEmpty() && $this->loop->isRunning()) {
         $this->callback = $this->queue->dequeue();
         $callback = $this->callback;
         // without this proxy PHPStorm marks line as fatal error.
         $callback($this->loop);
     }
 }
Example #2
0
 /**
  * @override
  * @inheritDoc
  */
 public function isRunning()
 {
     return $this->loop->isRunning();
 }
Example #3
0
 /**
  * @dataProvider loopsProvider
  * @param LoopExtendedInterface|LoopModelInterface|mixed $loop
  */
 public function testApiStartAndApiStop_StartsAndStopsLoop($loop)
 {
     $loop->onAfterTick(function () use($loop) {
         $this->assertTrue($loop->isRunning());
         $loop->stop();
         $this->assertFalse($loop->isRunning());
     });
     $loop->start();
     unset($loop);
 }