假设我将这两种方法排成一个for
循环
for (int i = 0; i < 100; i++)
{
ThreadPool.QueueUserWorkItem(s =>
{
Console.WriteLine("Output");
Thread.Sleep(1000);
});
}
for (int i = 0; i < 100; i++)
{
ThreadPool.QueueUserWorkItem(s =>
{
Console.WriteLine("Output2");
Thread.Sleep(1000);
});
}
有没有办法停止所有输出的线程Console.WriteLine("Output2");
但保持那些运行输出的线程Console.WriteLine("Output");
?