namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
Thread t = new Thread(() => WriteY("11"));
t.Start();
t.IsBackground = true;
Thread.CurrentThread.Priority = ThreadPriority.Highest;
for (int i = 0; i < 1000; i++) Console.Write("x");
System.Console.ReadLine();
}
static void WriteY(string ss)
{
for (int i = 0; i < 1000; i++)
Console.Write(ss);
System.Console.ReadLine();
}
}
}
您好,我认为“x”线程应该首先完成,因为它的优先级最高。但结果是他们仍在切换。