Hi,
I've got this code below, where I spawn several threads, normally about 7, and join them to wait until all are done:
List<Thread> threads = new List<Thread>();
Thread thread;
foreach (int size in _parameterCombinations.Keys)
{
thread = new Thread(new ParameterizedThreadStart(CalculateResults));
thread.Start(size);
threads.Add(thread);
}
// wait for all threads to finish
for (int index = 0; index < threads.Count; index++)
{
threads[index].Join();
}
When I check this most of the time only one or two threads are running at the same time, only once or twice when I rerun the app all of them executed.
Is there any way to force all the threads to start executing?
Many thanks.