thieumao

Simple MULTI THREAD

Sep 2nd, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6.  
  7. namespace TestDaLuong
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Thread t1 = new Thread(new ThreadStart(a));
  14.             Thread t2 = new Thread(new ThreadStart(b));
  15.             Thread t3 = new Thread(new ThreadStart(c));
  16.             t1.Start();
  17.             t2.Start();
  18.             t3.Start();
  19.             Console.ReadLine();
  20.         }
  21.         static void a()
  22.         {
  23.             for (int i = 0; i < 100; i++)
  24.             {
  25.                 Console.Write("1");
  26.             }
  27.         }
  28.         static void b()
  29.         {
  30.             for (int i = 0; i < 100; i++)
  31.             {
  32.                 Console.Write("2");
  33.             }
  34.         }
  35.         static void c()
  36.         {
  37.             for (int i = 0; i < 100; i++)
  38.             {
  39.                 Console.Write("3");
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment