C
Curious
Hi,
I have a large application that currently uses a timer at an interval
of 15 seconds.
At the beginning of every 15 seconds, it launches a big task. I worry
that it won't be able to finish such a big task in such a short time
period before the timer launches a new task in 15 seconds.
Therefore, I plan to start a new thread to do some work in order to
reduce the workload on the timer thread. Now I'm picking between the
following two:
//Option 1:
Thread newT = new Thread(new ThreadStart(DoSomeWork));
newT.Start();
//Option 2:
ThreadPool.QueueUserWorkItem(new WaitCallBack(DoSomeWork), null);
Anyone can advise me on which option I should use?
I have a large application that currently uses a timer at an interval
of 15 seconds.
At the beginning of every 15 seconds, it launches a big task. I worry
that it won't be able to finish such a big task in such a short time
period before the timer launches a new task in 15 seconds.
Therefore, I plan to start a new thread to do some work in order to
reduce the workload on the timer thread. Now I'm picking between the
following two:
//Option 1:
Thread newT = new Thread(new ThreadStart(DoSomeWork));
newT.Start();
//Option 2:
ThreadPool.QueueUserWorkItem(new WaitCallBack(DoSomeWork), null);
Anyone can advise me on which option I should use?