private void run() { try { SFuncQueue queue = _queue; _running = true; long lastTime = Ctrl.getTimer(); long time; int delay; int tickMax = _tickDelay; int tickTime = 0; while (_running) { time = Ctrl.getTimer(); delay = (int)(time - lastTime); lastTime = time; //防止系统时间改小 if (delay < 0) { delay = 0; } if (delay > 0) { if ((tickTime += delay) >= tickMax) { try { tick(tickTime); } catch (Exception e) { Ctrl.errorLog("线程tick出错", e); } tickTime = 0; } } try { runEx(); } catch (Exception e) { Ctrl.errorLog("线程runEx出错", e); } //再事务 queue.runOnce(); //最后睡 threadSleep(); } } catch (ThreadAbortException) { //线程结束 } catch (Exception e) { Ctrl.printExceptionForIO(e); } }