Aborting a suspended thread

  • Thread starter Thread starter Mark Denardo
  • Start date Start date
M

Mark Denardo

I'm trying to abort a suspended thread, but I get a ThreadStateException:

An unhandled exception of type 'System.Threading.ThreadStateException'
occurred in mscorlib.dll

Additional information: Thread is suspended; attempting to abort.

I have a number or threads in my program - some running, some suspended. I
hope I don't have to start the thread up again just to abort it??
 
MSDN Help wrote: ;)
If Abort is called on a thread that has not been started, the thread will
abort when Start is called. If Abort is called on a thread that has been
suspended, the thread is resumed and then aborted. If Abort is called on a
thread that is blocked or is sleeping, the thread is interrupted and then
aborted. If, while executing unmanaged code, a thread ignores a
ThreadAbortException, the system re-throws the ThreadAbortException when the
thread begins executing managed code.
 
Back
Top