Tech Off Post

Single Post Permalink

View Thread: More Advanced ThreadPool
  • User profile image

    pathfinder wrote:
    I think you would be better off using regular Threads instead of threadpool.  Just create 20 Threads and put them in a generic list to manage them.    Then you can do whatever you want with the threads.

    From experience, you can't rely on threadpool if you want pure performance.  Thread pool will only do the work if there are resources.  The more resources the more threads are running, the less system resources, the less threads are running.  

    I've seen thread pool go from 100 threads to 2 threads in a matter of minutes and never get back up in number again.  With regular threads you are guaranteed that all 100 are running always.


    You are going to have to manually handle the part where you want any busy running threads to complete, anyway.

    BTW, if your threading code was locking up, you're going to have to figure that part out.  Usually, it's when multiple threads are accessing a non-thread-safe object without a lock on that object.

    If you have questions about it, we might be able to help.