Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- namespace TestDaLuong
- {
- class Program
- {
- static void Main(string[] args)
- {
- Thread[] arrTh = new Thread[3];
- arrTh[0] = new Thread(new ThreadStart(a));
- arrTh[1] = new Thread(new ThreadStart(b));
- arrTh[2] = new Thread(new ThreadStart(c));
- for (int i = 0; i < arrTh.Length; i++)
- {
- arrTh[i].Start();
- }
- //Thread t1 = new Thread(new ThreadStart(a));
- //Thread t2 = new Thread(new ThreadStart(b));
- //Thread t3 = new Thread(new ThreadStart(c));
- //t1.Start();
- //t2.Start();
- //t1.Join();
- //t2.Join();
- //t3.Start();
- Console.ReadLine();
- }
- static void a()
- {
- for (int i = 0; i < 100; i++)
- {
- Console.Write("1 ");
- }
- }
- static void b()
- {
- for (int i = 0; i < 100; i++)
- {
- Console.Write("2 ");
- }
- }
- static void c()
- {
- for (int i = 0; i < 100; i++)
- {
- Console.Write("3 ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment