I have Timer callback thread which executes a particular function every 1 second. After certain event i am changing the timer to 60 seconds by disposing the old value and setting it to new one (60 seconds). Even after i dispose i see the function is being executed every second. I believe some of the thread request have queued up from the previous timer value since the time take to execute the function roughly takes around 3 seconds. This is my thread function
private void ThreadFunction(object sender)
{
getEvent();
return;
}
This is the getEvent function:
private void getEvent() {
mutex.WaitOne()
//do the task
.
.
mutex.ReleaseMutex()
}
However even after i change the timer to 60 seconds i still see the above function is being executed every sec
something like this to set to new timer value
eventThreadTimer.Dispose();
eventThreadTimer= new System.Threading.Timer(CallBack, null, dueTimeInterval, dueTimeInterval);
Could some one help me to over come this problem ?