Stopping a multi-threaded windows service
问题 I have a multi-thread windows service in .Net 3.5, and I am having some trouble to stop the service properly when more than one thread is created. This service used to create only one thread to do all the work, and I just changed it to be multi-threaded. It works perfectly, but when the service is stopped, if more than one thread is being executed, it will hang the service until all the threads are completed. When the service is started, I create a background thread to handle the main process