Killing Threads

  • Thread starter Thread starter mmitchell
  • Start date Start date
M

mmitchell

I have a service that executes a method in a dll. This method spawns
several threads.

When I stop the service I notice the process doesn't stop right away. I
assume the threads that some time to finish. What can I don the the
OnStop method to insure all threads are completed before stopping the
service?

Thanks for any help.
 
Hello Mitchell

The framework makes a distinction between threads that run in the
foreground and those in the background.
If a thread is marked as a background thread, the framework does not wait
for it to finish in the event that the AppDomain is shut down

so if your threads are foreground threads the AppDomain is shut down aftere
there completion

regards

Michel Posseth [MCP]
 
I think you cannot do that.
On shutdown, Windows only wait 2 secs to kill each serice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top