internal override TestResult Execute() { var result = new TestResult(); var threads = new List<Thread>(); var threadCounter = 0; while(threadCounter < numberOfThreads_) { foreach (var action in toTest_) { var unmodifiedClosure = action; threads.Add(new Thread(()=>RunTest(result.Exceptions, unmodifiedClosure))); threadCounter++; if(threadCounter >= numberOfThreads_) { break; } } } threads.ForEach(t=>t.Start()); threads.ForEach(t=>ForceJoin(t, result)); return result; }
private void ForceJoin(Thread toJoin, TestResult result) { if(!toJoin.Join(joinTimeout_)) { toJoin.Abort(threadAbortState_); result.Timeouts++; } }