Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function start(Timer $timer)
 {
     if (!isset($this->timers[$timer])) {
         $interval = $timer->getInterval();
         $event = $this->loop->timer($interval, $timer->isPeriodic() ? $interval : 0, $this->callback, $timer);
         $this->timers[$timer] = $event;
     }
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function start(Timer $timer)
 {
     if (!isset($this->timers[$timer])) {
         $handle = \uv_timer_init($this->loopHandle);
         $interval = $timer->getInterval() * self::MILLISEC_PER_SEC;
         \uv_timer_start($handle, $interval, $timer->isPeriodic() ? $interval : 0, $this->callback);
         $this->timers[$timer] = $handle;
         $this->handles[(int) $handle] = $timer;
     }
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function start(Timer $timer)
 {
     $flags = Event::TIMEOUT;
     if ($timer->isPeriodic()) {
         $flags |= Event::PERSIST;
     }
     $event = new Event($this->base, -1, $flags, $this->callback, $timer);
     $this->timers[$timer] = $event;
     $event->add($timer->getInterval());
 }