Ejemplo n.º 1
0
 private static void Execute(Printers printers)
 {
     while (true)
     {
         printers.Print(Thread.CurrentThread.Name);
         Thread.Sleep(100);
     }
 }
Ejemplo n.º 2
0
        public static void Run()
        {
            var printers = new Printers();

            for (int i = 0; i < 10; i++)
            {
                var thread = new Thread(() => Execute(printers));
                thread.Name = $"Thread #{i}";
                thread.Start();
            }
        }