I want to ask if a System.Timers.Timer instance runs on a single thread, a thread pool, or something else?
If it does run on a single thread, what do you think would be best for this example:
- I want to update all character’s health every minute
- I want to update all character’s energy every 2 seconds
- I want to update all character’s specials every 40 seconds
Should I run them each on a separate thread, run them on a separate event, or run all of those in a single thread having to check the time differences?
System.Timers.Timer elapsed event uses Threadpool. So multiple threads can be invoked if the interval is less( and elapsed event> interval takes long time to complete). Threadpool runs in background and UI updates cannot be done outside the UI thread in windows application. You can however use Control.Invoke Control.BeginInvoke
Link
Timers
difference between invoke and begininvoke