I want to run 10 threads on the same time and want to start a new one, if one is completed. So example: I create 10 Threads. If the 1. is finished, i want to start a new one, but i want to hold a maximum value of threads of 10.
How can i realize this?
I've tried it like this:
for (int z = 0; z < 10; z++)
{
Thread t = new Thread(() => check(name)); T.Start();
if (z == 9)
{
z = 0;
}
}
The Problem is here, that the program doesnt wait for the Threads to finish. How can i realize it here?
Thanks!