Aborting a suspended thread


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.

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