标签:catch queue string lin index back thread adp adk
static void Main(string[] args)
{
//写日志
//使用线程池
for (int i = 0; i < 1000; i++)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(ReceiveMessage), i);
}
Console.ReadKey();
}
private static void ReceiveMessage(object index)
{
Thread.Sleep(100);
int b = 0;
try
{
if (index.ToString() == "50")
{
Console.WriteLine(100 / b);
}
else
{
Console.WriteLine(index.ToString());
}
}
catch (Exception)
{
Console.WriteLine(index+":出错");
}
}
标签:catch queue string lin index back thread adp adk
原文地址:https://www.cnblogs.com/qiu18359243869/p/10783556.html