System.Threading.Thread.ResetAbort Method

Cancels an Thread.Abort(object) requested for the current thread.

Syntax

public static void ResetAbort ()

Exceptions

TypeReason
System.Threading.ThreadStateException Thread.Abort(object) was not invoked on the current thread.
System.Security.SecurityException Caller does not have System.Security.Permissions.SecurityPermissionFlag.ControlThread security permission for the current thread.

Remarks

This method can only be called by code with the proper permissions. For more information see [<topic://cpconMakingSecurityDemands>].

When a call is made to Abort to terminate a thread, the system throws a System.Threading.ThreadAbortException. ThreadAbortException is a special exception that can be caught by application code, but is rethrown at the end of the catch block unless ResetAbort is called. ResetAbort cancels the request to abort, and prevents the ThreadAbortException from terminating the thread.

See System.Threading.ThreadAbortException for an example that demonstrates calling the ResetAbort method.

Permissions

Example

For an example that demonstrates calling this method, see System.Threading.ThreadAbortException .

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0