private void InitializeThreads(int threadCount) { foreach (JobProcessor jobProcessor in this.threads) { jobProcessor.Stop(); } this.threads.Clear(); this.Thread_Perfs = null; if (threadCount <= 0) { return; } this.Thread_Perfs = new PerformanceTestRunner.ThreadPerformance[threadCount]; for (int i = 0; i < threadCount; i++) { JobProcessor jobProcessor2 = new JobProcessor(); jobProcessor2.ExceptionOccur += this.thread_ExceptionOccur; PerformanceTestRunner.ThreadPerformance threadPerformance = PerformanceTestRunner.ThreadPerformance.MakePerf(jobProcessor2); threadPerformance.ExceptionOccur += this.thread_ExceptionOccur; threadPerformance.Name = string.Format("Thread{0}", i); this.Thread_Perfs[i] = threadPerformance; jobProcessor2.Start(); this.threads.Add(jobProcessor2); } this.AssignThreads(); }
public static PerformanceTestRunner.ThreadPerformance MakePerf(JobProcessor thread) { PerformanceTestRunner.ThreadPerformance threadPerformance = new PerformanceTestRunner.ThreadPerformance(); threadPerformance.BindThread(thread); return(threadPerformance); }