日期:2014-05-17  浏览次数:20897 次

ThreadPool的问题,大家来帮看看
部分代码

//初始化线程池数量
ThreadPool.SetMaxThreads(50, 50);
ThreadPool.SetMinThreads(20, 20);

//这里是增加线程 这些个for循环是在一个方法里 方法又是让timer定时5秒调用一次的
           for (int j = 0; j < geturlList.Count; j++)
           {
               object o = geturlList[j];
               ThreadPool.QueueUserWorkItem(sendMyData, o);
            }
            for (int j = 0; j < this.geturlListUp.Count; j++)
            {
                object o = geturlListUp[j];
                ThreadPool.QueueUserWorkItem(sendMyData, o);
            }

            for (int x = 0; x < posturlList.Count; x++)
            {
                string[] tmpstrs = { posturlList[x], refurlList[x], paramList[x] };
                object o = tmpstrs;
                ThreadPool.QueueUserWorkItem(sendMyDataTwo, o);
            }
            for (int x = 0; x < this.posturlListUp.Count; x++)
            {
                string[] tmpstrs = { posturlListUp[x], refurlListUp[x], paramListUp[x] };
                object o = tmpstrs;
                ThreadPool.QueueUserWorkItem(sendMyDataTwo, o);
            }

    //这是线程调用的一个方法里边的部分内容
            try
            {
                lock (myparam)//这里的myparam就是传过来的参数
                {
                    string geturlt = myparam.ToString();

                    if (tureVal)//验证
           &n