Shutdown multithreaded app or Thread.Abort

G

Guest

Hello,
I have a multithreaded app that did not have problem closing down on XP
computer.
But on Windows server 2003, one thread is not stopping and I can not delete
the process from task manager either. This is Windows Form app. I am using
Thread.Abort to cancel threads. It is hard to catch wich thread hangs. How
can I debug better? any tools that I can use? Is Thread.Abort bad? Thanks.
 
G

Guest

Hi Tony,

One technique you might want to use is to mark particular threads as
background threads, background threads won't stop your application from
terminating when your non-background threads exit.

It is also useful to name your threads, it makes debugging easier. Can you
attach to your application when it won't exit, pause it, and see which
threads are still running?

Hope this helps.

Regards,
Matt Garven
 
H

Herfried K. Wagner [MVP]

Tony said:
I have a multithreaded app that did not have problem closing down on XP
computer.
But on Windows server 2003, one thread is not stopping and I can not
delete
the process from task manager either. This is Windows Form app. I am using
Thread.Abort to cancel threads. It is hard to catch wich thread hangs. How
can I debug better? any tools that I can use? Is Thread.Abort bad?
Thanks.

Instead of using 'Thread.Abort', set the threads' 'IsBackground' property to
'True'. Background threads will be terminated when the main thread is
terminated.
 

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

Top