When a call is made to the <xref:System.Threading.Thread.Abort%2A> method to destroy a thread, the common language runtime throws a <xref:System.Threading.ThreadAbortException>. <xref:System.Threading.ThreadAbortException> is a special exception that can be caught, but it will automatically be raised again at the end of the `catch` block. When this exception is raised, the runtime executes all the `finally` blocks before ending the thread. Because the thread can do an unbounded computation in the `finally` blocks or call <xref:System.Threading.Thread.ResetAbort%2A?displayProperty=nameWithType> to cancel the abort, there is no guarantee that the thread will ever end. If you want to wait until the aborted thread has ended, you can call the <xref:System.Threading.Thread.Join%2A?displayProperty=nameWithType> method. <xref:System.Threading.Thread.Join%2A> is a blocking call that does not return until the thread actually stops executing.
0 commit comments