System.Threading.Timer

时间:2023-03-09 20:31:36
System.Threading.Timer
GLog.WLog("_thdTimer before");
_thdTimer = new System.Threading.Timer(new TimerCallback(TimerProc));
//2秒后开始执行计时器;每3秒执行一次
_thdTimer.Change(,);
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