Should I put my timer to sleep when my main method is running on a Windows service?
2 answers
This is not really a "main method", but I suppose you just mean the method that is called as a result of a past event. It depends. You need it to run every interval, or you just need it to start at every interval, and if it is already running, do nothing.
If the latter is what I suspect, since you are asking about it, then yes, go ahead and stop your timer as the first statement in your past event handler. Then start the timer again when you're done with everything else in your "main method".
+1
source to share