internal void threadedVerify(int numthreads)
{
this.records_read = 0;
DateTime start = DateTime.Now;
List<Thread> threads = new List<Thread>();
// now do the same thing simultaneously in multiple threads
for (int threadnum = 0; threadnum < numthreads; threadnum++) {
Thread newthread = new Thread(new ThreadStart(this.verifyData));
newthread.Start();
threads.Add(newthread);
Thread.Sleep(1);
}
foreach (Thread th in threads) {
// rejoin the threads
th.Join();
}
DateTime end = DateTime.Now;
TimeSpan duration = end - start;
double dur_ms = (end - start).TotalMilliseconds;
double records_per_second = (double)this.records_read * (1000.0 / dur_ms);
System.Console.WriteLine("ReadThreads ({0} records) in elapsed time: {1} -- {2} rec/sec",
this.records_read, duration, records_per_second);
Assert.AreEqual(false, had_errors, "should have no read errors");
}