Beispiel #1
0
 public static void ajouter(FileThreadUnsafe<String> f,List<String> noms)
 {
     foreach(var nom in noms)
     {
         f.Enfiler(nom);
     }
 }
Beispiel #2
0
 public static void retirer(FileThreadUnsafe<String> f, int cpt)
 {
     for(int i=0;i<2;i++)
     {
         f.Defiler();
     }
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            f = new FileThreadUnsafe<int>(10);

            for (int i = 1; i <= 10; i++)
            {
                try
                {
                    f.Enfiler(i);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Erreur : " + e.Message);
                }
            }
            AfficherNBElement(f.NbElements());

            th1 = new Thread(Lancement1);
            th2 = new Thread(Lancement2);

            th1.Start();
            th2.Start();

            th1.Join();
            th2.Join();

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            f = new FileThreadUnsafe<int>(10);

            for (int i = 0; i < 100; i++)
            {
                try { f.Enfiler(i); }
                catch (Exception e) { Console.WriteLine("La file est pleine"); break; }
            }
            Console.WriteLine("Nombre d'élements: "+ f.NbElements());

            th1 = new Thread(TH1Func);
            th2 = new Thread(TH2Func);
            th1.Start();
            th2.Start();
            th1.Join();
            th2.Join();
        }