예제 #1
0
파일: Timer.php 프로젝트: JeeLiu/tsf
 /**
  * [init 启动定时器]
  * @return [type] [description]
  */
 public static function init()
 {
     if (!isset(self::$tickKey)) {
         self::$tickKey = swoole_timer_tick(1000 * self::LOOPTIME, function () {
             //循环数组,踢出超时情况
             self::loop();
         });
         \SysLog::info(__METHOD__ . " init timer tick key == " . self::$tickKey, __CLASS__);
     }
 }
예제 #2
0
파일: Timer.php 프로젝트: huazi736/tsf
 /**
  * [init 启动定时器]
  * @return [type] [description]
  */
 public static function init()
 {
     if (!self::$isOnTimer) {
         swoole_timer_after(1000 * self::LOOPTIME, function () {
             //循环数组,踢出超时情况
             self::loop();
             self::$isOnTimer = false;
         });
         self::$isOnTimer = true;
     }
 }