Reputation: 890
Where and how to check through code number of threads available in threadpool.
What i want is: For example if no of threads in threadpool are 10 then at any given time I should not be using say more than 3 threads. Once an existing thread gets free, I should start a new task, keeping max count 3.
Upvotes: 14
Views: 15225
Reputation: 446
ThreadPool.GetAvailableThreads will give you number of available threads. ThreadPool.GetMaxThreads will give you max number of threads. The difference will give you the number of active threads.
Upvotes: 20