Sorry if this is a newbie question.
I have a VB.NET subroutine that is triggered by a timer. I have found that on occasion, if the routine runs for a long time, the routine will be triggered again while it is still running with unpredictable results. Is this normal? Is each copy of the routine running in its own thread? Is there a way to serialize the routines? Right now I use a Boolean that I set True on entry and False when I am done so I can check if the routine is running when I enter it, but I thought that there might be something more elegant.
Stop the timer when you start executing your subroutine, and start it again on exit.
You should probably include error handling such that the timer is restarted even on an unexpected exit.