I would like to know what kind of timers can be used in a C# application and what are their implications in term of cuncurrency in a multi-threaded environment.
Could you explain me or link me to an esaustive tutorial?
Thank you.
views:
74answers:
1
+5
A:
There are two forms of timers - ones that are message based, and typically UI centric, and ones that are thread-based.
The UI versions are the Timer class from Windows Forms or the DispatcherTimer in WPF. These tend to report timings (normally) on the UI thread, and basically use the standard message pump to handle timing.
The System.Timers.Timer and System.Threading.Timer classes use a separate thread for handling timers. These work very well, but the "Tick" events happen on a separate thread. This means you need to handle thread synchronization or UI threading synchronization if you use these.
Reed Copsey
2010-02-22 19:57:11