timer

  • Thread starter Thread starter Anonymous
  • Start date Start date
What are you trying to do?
Threading.Timer is thread safe.
You can have it fire periodically or just once by altering the last argument
of its Change method.

Cheers
Daniel
 
If it is set up to be fired periodically, is it possible
it could be fired before the previous call has exited?
 
I would most certainly expect it to. However this is so easy to test for
yourself (set a timer up and stick some debug output).

My general advice on timers is not to set up periodic ones (regardless of
technology). Fire a single shot one and restart it if you need after it is
done. I am sure there are scenarios where you truly need a periodic one but
I have not come across one that is not handled by restarting the timer in
the callback.

Update: Just did a quick test and my expectation was correct.

Cheers
Daniel
 
Yes it will fire again if the previous one has not ended. To stop the
Thread.Timer call Change with the param System.Threading.Timeout.Infinite at
the beginning of your callback method and at the end reset it back to your
original timespan.
 
Back
Top