private static void Iterations(LogBase log) { for (int i = 0; i < _iterations; i++) { log.Write(_messages[i % _msgCount]); if (_sleep != 0) { Thread.Sleep((int)_sleep); } } }
private static void Run(LogBase log) { List <Task> tasks = new List <Task>(_taskCount); for (int i = 0; i < _taskCount; i++) { tasks.Add(Task.Factory.StartNew(() => { Iterations(log); }, TaskCreationOptions.LongRunning)); } Task.WaitAll(tasks.ToArray()); }