stop thread immediatly

  • Thread starter Thread starter Ha ha
  • Start date Start date
H

Ha ha

I create a main thread ,than create a subthread in the main thread,when
i found any error,i want to stop the subthread and the main thread
immediatly .How can i do for it.
 
Are you sure you want to do that? If you stop both threads, the
application will just dissapear, and that's not exactly a good user
experience.

If an exception occurs in a thread, and that exception is not handled,
then the thread is terminated automatically.

What are you trying to do?
 
thank for your reply.

I create three threads in a process,each thread has its own
subthread,when error occured in any thread,i want to stop all the
thread.so i use thread.abort() to stop threads,but exception occured, Do
you have any good idea for that.
 
You should never use Thread.Abort on another thread than the CurrentThread.
Use a shared flag or a synchronization Event to indicate wheter your threads
have to exit.

Willy.
 
Back
Top