Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will serial calls to Threading.Timer.Change() reset the timer's clock?

Tags:

c#

.net

timer

If I call Threading.Timer.Change() twice in a row, when will the thread next run?

For example:

myTimer.Change(5000, Timeout.Infinite);
// Only 2 seconds pass.
myTimer.Change(5000, Timeout.Infinite);

After this, will the thread next run in 3 seconds or 5 seconds?

I hope the answer is the latter, that the timer is reset with each call of Change(). If not, I'll need to find a way around this.

like image 589
joshdick Avatar asked Jul 14 '09 19:07

joshdick


1 Answers

It will run in 5 seconds. Calling Change will Reset the initial Count.

like image 178
JaredPar Avatar answered Nov 15 '22 14:11

JaredPar