Smart Thread Pool (智能线程池)

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
 
posted on 2017-03-29 11:24  fiftha  阅读(916)  评论(2编辑  收藏  举报