Esempio n. 1
0
            public void ChangeSize(int threadNum)
            {
                bool isNew = false;

                lock (list)
                {
                    int num = list.Count;
                    isNew = num > threadNum;
                    if (isNew)
                    {
                        for (int i = 0; i < num - threadNum; i++)
                        {
                            KThread t = list[0];
                            t.tStop = true;
                            t.Dispose();
                            list.Remove(t);
                        }
                    }
                    else
                    {
                        for (int i = 0; i < threadNum - num; i++)
                        {
                            KThread t = new KThread();
                            list.Add(t);
                            t.Start(job);
                        }
                    }
                }
            }