为什么我的线程 优先级 没好使呢?
程序代码:
objThreadTwo.Priority = ThreadPriority.Highest; 这句咋没好用呢? 运行结果依然是 第一个线程先运行~ class Program { static void Main(string[] args) { Thread.CurrentThread.Name = "主线程"; Thread objThreadOne = new Thread(new ThreadStart(TaskOne)); objThreadOne.Name = "子线程1"; Thread objThreadTwo = new Thread(new ThreadStart(TaskTwo)); objThreadTwo.Name = "子线程2"; objThreadOne.Start(); objThreadTwo.Start(); objThreadTwo.Priority = ThreadPriority.Highest; Console.ReadLine(); } static void TaskOne() { for (int i = 0; i <= 5; i++) { Console.WriteLine(i*2); } } static void TaskTwo() { for (int index = 5000; index >= 4990;index-- ) { Console.WriteLine(index); } }