I work in a Windows environment (Visual Studio 2019). I want to create a c++ application that has to perform many times: let's say 10000 times. I want to implement this using multiple threads and, of coursem I want to limit the number of the concurrent threads let's say 20. In other words I want to do the same thing that in a c# application I can easy do with the parallel instruction:
public class Program
{
private static void Main(string[] args)
{
ParallelOptions opt = new ParallelOptions();
opt.MaxDegreeOfParallelism = 20;
Parallel.For(0, 10000, opt, i =>
{
// Do the task
});
}
}