I would like to do a for-loop which creates more threads.
I've tried with:
int i;
for (i = 0; i < 10; i++) {
thread t1(nThre);
t1.join();
cout << "Joined thread n'" << i << '\n';
}
But it does not work. nThre
is called sequentially (it is a simple void
routine).
I'm also asking if I can use a pre-increment as i
is just an int
, so:
++i
insted of i++
, which should be more performant.