I'm building a windows service in c# that has a thread pool being used to process messages from an MSMQ. A new thread is created by a manager thread to process each message fed by an asyncronous reader reading the queue.
My question is... how do I allow the user to shutdown the thread pool in a graceful manner?
My current thinking is that I stop the reader and then to wait until all threads in the pool have completed. The bit I'm stuck on exactly how to do this so would very much appreciate some assistance.