Is there a way to tell the thread pool mananger to only have x number of threads invoking a specific method or group of methods?
I have an application where I use thread pool worker threads all over the place, and it works swimmingly; one of the tasks I consign to the worker threads is a web service call, however, and it will reject more than 5 concurrent requests. I don’t want to limit the thread pool to 5 threads, because many other things use the threads and can handle a great many more.
Is there a way to “compartmentalize” a thread pool to say “you will have a maximum of x threads active doing this particular thing at any point in time, but the rest of you threads can go do other stuff”?
Create another threadpool and SetMaxThreads(5) – it’s the easiest way.
OK, you can’t do it with Threadpool class.
Just so I’m not downvoted:
It’s not like the ‘real’ System.Threading.Threadpool, but it is a threadpool with a fixed number of threads