Destroying Threads : Thread Abort « Thread « C# / CSharp Tutorial






using System;
using System.Threading;

class MainClass
{
  static int MyCount = 0;
  static void Main(string[] args)
  {
    MyClassThread me = new MyClassThread();
    Thread MyNewThread = new Thread(new ThreadStart(me.MyThread));

    MyNewThread.Start();
    if (MyCount == 0)
      MyNewThread.Abort();
  }
}

class MyClassThread
{
  public void MyThread()
  {
  }
}








20.4.Thread Abort
20.4.1.Destroying Threads
20.4.2.Use ResetAbort()
20.4.3.Use Abort(object)
20.4.4.Stopping a thread