Raises a ThreadAbortException in the thread, which usually results in the thread's death.
[Visual Basic] Overloads Public Sub Abort( _ ByVal stateInfo As Object _ ) [C#] public void Abort( object stateInfo ); [C++] public: void Abort( Object* stateInfo ); [JScript] public function Abort( stateInfo : Object );
The ThreadAbortException is a special exception that is not catchable. The finally clauses of all try statements will be executed before the thread dies. This includes the finally that a thread might be executing at the moment the Abort is raised. The thread is not stopped immediately--you must Join on the thread to guarantee it has stopped.
It is possible for a thread to do an unbounded amount of computation in the finally's and thus indefinitely delay the threads death. If Abort is called on a thread that has not been started, the thread will abort when Start is called. If Abort is called twice on the same thread, a DuplicateThreadAbort exception is thrown. It is possible for a thread to do an unbounded amount of computation in the finally's and thus indefinitely delay the threads death. It is also possible for a thread to swallow the Abort in unmanaged code. The runtime will detect this and will re-throw the ThreadAbortException when the thread returns back to managed code.
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 two aborts come at the same time, it is possible that the state info gets set by one, and the actual abort gets delivered by another. But this is not distinguishable by an application.
Thread Class | Thread Members | System.Threading Namespace | Thread.Abort Overload List