码迷,mamicode.com
首页 > 编程语言 > 详细

线程池

时间:2015-05-15 10:31:44      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

https://msdn.microsoft.com/zh-cn/library/system.threading.threadpool(v=vs.110).aspx

最基础的

 class Program
    {
        static void Main(string[] args)
        {
            int oldMaxWorkingThreads, oldMaxCompletionPortThreads;

            ThreadPool.GetMaxThreads(out oldMaxWorkingThreads, out oldMaxCompletionPortThreads);

            int oldMinWorkingThreads, oldMinCompletionPortThreads;

            ThreadPool.GetMinThreads(out oldMinWorkingThreads, out oldMinCompletionPortThreads);

            Console.WriteLine(string.Format("oldMaxWorkingThreads={0},oldMaxCompletionPortThreads={1}", oldMaxWorkingThreads, oldMaxCompletionPortThreads));
            Console.WriteLine(string.Format("oldMinWorkingThreads={0},oldMinCompletionPortThreads={1}", oldMinWorkingThreads, oldMinCompletionPortThreads));

            Console.WriteLine(Environment.ProcessorCount);//cpu的核数

            Console.ReadKey();
        }
    }

 

线程池

标签:

原文地址:http://www.cnblogs.com/chucklu/p/4505215.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!