GLog.WLog("_thdTimer before"); _thdTimer = new System.Threading.Timer(new TimerCallback(TimerProc)); //2秒后开始执行计时器;每3秒执行一次 _thdTimer.Change(2000,3000); GLog.WLog("_thdTimer after"); private void TimerProc(object state) { try { GLog.WLog("threading timer tick"); } catch (Exception ex) { } }
2017-04-24 00:20:34.821 _thdTimer before
2017-04-24 00:20:34.821 _thdTimer after
2017-04-24 00:20:36.827 threading timer tick
2017-04-24 00:20:39.839 threading timer tick
2017-04-24 00:20:42.849 threading timer tick
2017-04-24 00:20:45.861 threading timer tick
2017-04-24 00:20:48.871 threading timer tick
2017-04-24 00:20:51.880 threading timer tick
时间: 2024-10-21 06:00:41