RP wrote:
I have a Timer control on a form. When this Timer starts, it will do
certain task on every tick. I want that this Timer be linked to a new
thread so that the Timer does not disturb other activities. How to
create a new thread and link this Timer to it?
In addition to what Ignacio already wrote...
It seems to me that if you necessarily want the timer-signaled code to
execute on a different thread, then one of the Timer classes that
actually use a different thread for signaling the timer would be a
better solution than using the Forms.Timer class.
Forms.Timer is great for situations when you specifically want the
timer-signaled code executing on the main UI thread and the resolution
is sufficient for your needs. But it sounds like you want the opposite
(not executing on the main UI thread) and so using Forms.Timer is
counter-productive.
Also, if you still wind up for whatever reason assigning a different
thread to the code in response to the signaling of the timer, it would
probably be better to use a thread pool thread rather than creating a
whole new one. This is a general rule, not absolute advice. As the
timer interval is longer, and the code executed takes more time, the
overhead of creating a brand new thread is made relatively smaller and
isn't as big a problem.
Pete