private static void Main(string[] args) { int id = 1; var thread = new TrackedThread(() => Test(id)); thread.Thread.Name = "goc" + id.ToString(); thread.Thread.Start(); }
private static void Main(string[] args) { TrackedThread thread1 = new TrackedThread(DoNothingForFiveSeconds); TrackedThread thread2 = new TrackedThread(DoNothingForTenSeconds); TrackedThread thread3 = new TrackedThread(DoNothingForSomeTime); thread1.Thread.Start(); thread2.Thread.Start(); thread3.Thread.Start(15); while (TrackedThread.Count > 0) { Console.WriteLine(TrackedThread.Count); } Console.ReadLine(); }
private static void Test(int id) { List <int> lst = new List <int>() { 1, 2, 3 }; while (true) { foreach (var i in lst) { var thread = new TrackedThread(() => DongBoTest(i)); thread.Thread.Name = i.ToString(); thread.Thread.Start(); } //Nhon Task delay = Task.Delay(19 * 60000); delay.Wait(); } }