Program.cs 765 B

12345678910111213141516171819202122232425262728293031323334
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. namespace Esercizio_file_tepi
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. GestioneThread gt = new GestioneThread();
  13. Thread th1 = new Thread(new ThreadStart(gt.AddFile));
  14. th1.Name = "th1";
  15. th1.Start();
  16. Thread th2 = new Thread(new ThreadStart(gt.LeggereF));
  17. th2.Name = "th2";
  18. th2.Start();
  19. while ((th1.IsAlive) && (th2.IsAlive))
  20. {
  21. Thread.Sleep(10);
  22. }
  23. th1.Join();
  24. th2.Join();
  25. Console.ReadKey();
  26. }
  27. }
  28. }