Cancel() public static method

Removes a queued thread from thread pool if still queued, if allowAbort is True aborts the thread if executing (standard or queued)
public static Cancel ( GSF.Threading.ManagedThread item, bool allowAbort, object stateInfo ) : void
item GSF.Threading.ManagedThread Thread to cancel
allowAbort bool Set to True to abort thread if executing
stateInfo object An object that contains application-specific information, such as state, which can be used by the thread being aborted.
return void
Example #1
0
 /// <summary>
 /// Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread.
 /// </summary>
 public void Abort()
 {
     ManagedThreads.Cancel(this, true, null);
 }
Example #2
0
 /// <summary>
 /// Raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Calling this method usually terminates the thread.
 /// </summary>
 /// <param name="stateInfo">An object that contains application-specific information, such as state, which can be used by the thread being aborted.</param>
 public void Abort(object stateInfo)
 {
     ManagedThreads.Cancel(this, true, stateInfo);
 }