ThreadPool

Posted by lorenb on 10/1/2004 in projects |

When I was doing my threading work yesterday at first I was just creating/destroying threads as I needed them. That however isn’t really the most efficient method. So I converted my code to use the ThreadPool class in System.Threading.

The way it’s supposed to work, a default pool of 25 threads is created (you can increase this if necessary) and just add work to the queue. The ThreadPool takes care of managing the threads and executing jobs from the queue.

So I got my code working under Linux and it seemed good. Then I noticed every once in a while the program would hang. That was strange so tried it under Windows, and it didn’t do anything, it ran and exited immediately.

Clearly I’ve made some kind of error but I’m not yet sure what it is yet. I know I’ll eventually figure it out, it’s just frustrating now because it’s holding back my progress.

Lots of debugging planned for today :)

Copyright © 2004-2010 LB Technology Services Blog All rights reserved.
Desk Mess Mirrored v1.7 theme from BuyNowShop.com.