public void Increase(int threadCount)
{
if (threadCount < 1)
return;
lock (this)
{
int index = 0;
if (_threads == null)
{
index = 0;
_threads = new Thread[threadCount];
}
else
{
index = _threads.Count();
// 기존 Thread 객체를 새 배열로 복사
Thread[] temp = new Thread[_threads.Count() + threadCount];
for (int i = 0; i < _threads.Count(); ++i)
temp[i] = _threads[i];
_threads = temp;
}
for (int i = index; i < index + threadCount; ++i)
{
_threads[i] = new Thread(Run);
_threads[i].Name = string.Format("{0} {1}", Name, i);
}
}
}