.NET 4 introduced a brand new thread pool design accessed by the Task Parallel library. But if I have old code that uses Delegate.BeginInvoke, will those be executed by that new thread pool? Or is the old thread pool still in the runtime somewhere?
They both use the same ThreadPool. ThreadPool.QueueUserWorkItem
does, as well.
However, Delegate.BeginInvoke
has extra overhead when compared to Task.Factory.StartNew, and does not take advantages of many of the features in the ThreadPool, such as work stealing or the new debugging features. I would recommend refactoring this to use the new Task features as time permits.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With