码迷,mamicode.com
首页 > 其他好文 > 详细

System.Threading.Timer

时间:2017-04-24 01:06:28      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:time   call   oid   private   pre   bsp   obj   计时器   开始   

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

 

System.Threading.Timer

标签:time   call   oid   private   pre   bsp   obj   计时器   开始   

原文地址:http://www.cnblogs.com/runliuv/p/6754807.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!