I have done a lot of multi-threaded programming, but learnt a basic thing today... What is executed on a timer method runs blocking the main thread. So, if you want it to be multi-threaded, create a thread within it...
What this means is that if you have explicit code within a timer event handler, then when that executes, it blocks the main thread if anything is running on it. So, to get the best performance, do not write code directly within the timer event handler - create a new thread and have it do the work.
The best way to create threads without too much hassle is to use ThreadPool.QueueUserWorkItem()
Please say more on your findings.
ReplyDelete