Détruire un Thread

Author:


{filelink=17391}

using System;
using System.Threading;

  public class DetruireThreads
  {
    static int compteur ;
    static void Main(string[] args)
    {
      ClassThread monTh = new ClassThread();
      Thread objetThread = new Thread(new ThreadStart(monTh.MyThread));

      objetThread.Start();
	  for(compteur=0;compteur>10;compteur++)
	  {
      if (compteur == 7)
        objetThread.Abort();
	 }
    }
  }
  class ClassThread
  {
    public void MonThread()
    {
	Console.WriteLine("Mon Thread Lancé");
    }
  }

Leave a Reply

Your email address will not be published. Required fields are marked *