addTimer() public method

The execution order of timers scheduled to execute at the same time is not guaranteed.
public addTimer ( float $interval, callable $callback ) : Kraken\Loop\Timer\TimerInterface
$interval float
$callback callable
return Kraken\Loop\Timer\TimerInterface
示例#1
0
 /**
  * @override
  * @inheritDoc
  */
 public function addTimer($interval, callable $callback)
 {
     return $this->loop->addTimer($interval, $callback);
 }
示例#2
0
 /**
  * @dataProvider loopsProvider
  * @param LoopExtendedInterface|LoopModelInterface|mixed $loop
  */
 public function testApiIsTimerActive_ReturnsFalse_ForInActiveTimer($loop)
 {
     $timer = $loop->addTimer(0.001, $this->expectCallableNever());
     $loop->cancelTimer($timer);
     $this->assertFalse($loop->isTimerActive($timer));
     unset($timer);
     unset($loop);
 }