class Program
{
static void Main()
{
//没啥作用,除非你 限制一个进程,把线程都在里面跑,限制住一个cpu内核..
Thread t = new Thread(ShowMessage);
t.Name = "One";
//最高等级
t.Priority = ThreadPriority.Highest;
//最低等级
Thread t1 = new Thread(ShowMessageNoSleep);
t1.Name = "Second";
t1.Priority = ThreadPriority.Lowest;
t.Start();
t1.Start();
Console.ReadKey();
}
static void ShowMessage()
{
for (var i = 0; i < 10; i++)
{
Thread.Sleep(1000);
Console.WriteLine(i);
}
}
static void ShowMessageNoSleep()
{
for (var i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
}
}
{
static void Main()
{
//没啥作用,除非你 限制一个进程,把线程都在里面跑,限制住一个cpu内核..
Thread t = new Thread(ShowMessage);
t.Name = "One";
//最高等级
t.Priority = ThreadPriority.Highest;
//最低等级
Thread t1 = new Thread(ShowMessageNoSleep);
t1.Name = "Second";
t1.Priority = ThreadPriority.Lowest;
t.Start();
t1.Start();
Console.ReadKey();
}
static void ShowMessage()
{
for (var i = 0; i < 10; i++)
{
Thread.Sleep(1000);
Console.WriteLine(i);
}
}
static void ShowMessageNoSleep()
{
for (var i = 0; i < 10; i++)
{
Console.WriteLine(i);
}
}
}