コード例 #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;
     }
 }