首页 > 编程语言 > 详细

Smart Thread Pool (智能线程池)

时间:2017-03-29 13:23:55      阅读:265      评论:0      收藏:0      [点我收藏+]
STPStartInfo stp = new STPStartInfo();
  stp.DisposeOfStateObjects = true;
  stp.CallToPostExecute = CallToPostExecute.Never;
  stp.ThreadPriority = ThreadPriority.Highest;
  stp.UseCallerCallContext = true;
  stp.MaxWorkerThreads = 4;
 
  //职能线程池
  var smartThreadPool = new SmartThreadPool();
  // 执行任务
  smartThreadPool.QueueWorkItem(() =>
  {
    //加载需要处理的数据
    log.InfoFormat("@-->Excete 数据条数{0}", asyncCalls.Count);
    if (asyncCalls != null && asyncCalls.Count > 0)
    {
      foreach (var item in asyncCalls)
      {
        ExecuteService.ExecuteItem(item);
      }
    }
  });
 
请先下载 SmartThreadPool.dll
 

Smart Thread Pool (智能线程池)

原文:http://www.cnblogs.com/newnj/p/6638863.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!