public void StopWorkersAsync(int threadCount) { for (int i = 0; i < threadCount && _allThreads.Count != 0; i++) { IThread thread = _allThreads.Keys.First(); thread.QueueStopThreadAsync(); RemoveThread(thread); } }