Link to home
Start Free TrialLog in
Avatar of neviljer
neviljer

asked on

Shutting down a thread pool contained in a windows service.

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.
ASKER CERTIFIED SOLUTION
Avatar of shivsa
shivsa
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial