Scheduled task with windows services and system.timer.timer

i want implement a windows services scheduled task. I already created windows service. In a service i have implemented a timer.The timer is initialized at class interval. The timers interval is set in the start method of service and also it is enabled in the start method of the service. After timers elapsed event is fire i have done some actions.

My problem is that, i am in a dilemma. Lets say the action i have done in Elapsed event, lets say take one hour and the timers interval is set to half an hour. so there are chances that even if the previous call to elapsed event has not ended new call to elapsed event will occur.

my question will there be any conflict or is it ok or shall i use threads. please give some advice


您可以在长时间运行的方法开始时停止计时器,然后在最后再次启动计时器:

Timer.Change(Timeout.Infinite, Timeout.Infinite)
// do long task ...
Timer.Change(dueTime,period)
链接地址: http://www.djcxy.com/p/63006.html

上一篇: 处置或不处置(CA2000)

下一篇: 计划任务与Windows服务和system.timer.timer