, , Abort, ( .NET).
. Abort , . ( ), ( volatile bool, .
,
public class ThreadClass
{
private volatile bool stopRequested;
private Thread thread;
public void Start()
{
stopRequested = false;
thread = new Thread(ThreadMethod);
thread.Start();
}
public void Stop()
{
stopRequested = true;
if(!thread.Join(5000)) thread.Abort();
}
private void ThreadMethod()
{
}
}
ThreadMethod. stopRequested. , ( ) . , , ( , ) , true. , , , , , .