多线程处理
while (true)
{
Thread.Sleep(1000);//这句写着,主要是没必要循环那么多次。去掉也可以。
int maxWorkerThreads, workerThreads;
int portThreads;
ThreadPool.GetMaxThreads(out maxWorkerThreads, out portThreads);
ThreadPool.GetAvailableThreads(out workerThreads, out portThreads);
if (maxWorkerThreads - workerThreads == 0)
{
Console.WriteLine("结束了");
break;
}
}