Shutdown multithreaded app or Thread.Abort

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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.
 
Back
Top