OK here's a question:
I have a program that batch manipulates a few thousand images (cropping and resizing). I use ThreadPool and have the worker threads do all the image processing, and that works fine.
My main question is how to signal that the work is complete -- that is, some way I know that every thread in the queue has finished. Ideally I'd like a particular thread to wait until every worker thread was finished, and then resume execution. Effectively my program has a GUI thread, a thread that recurses over folders seeking images, and then worker threads which process the images that are found. I'd like that second thread (the recursing thread) to suspend once it's fully recursed, and not continue execution until all worker threads were done.
Now I know I could use a ManualResetEvent[], and then WaitForAll on it -- this is how a lot of example code works. This isn't all that great for me because:
1. That array could be tens of thousands of entries (maybe a problem, maybe not, I dunno),
2. My worker threads are created before I know a final count of how many worker threads there will be. As such, I wouldn't know how large of an array to make.