what the difference when the number of threads is determined, as e.g.:
for (i*10){
...
pthread_create(&thread[i], NULL, ThreadMain[i], (void *) xxx);
...
}
and when it is undetermined, just like this:
...
pthread_create(&threadID, NULL, ThreadMain, (void *) xxx);
...
In my case the number i can varry from 1 to 10. If e.g. I use the first method, I need to create 10times as e.g.:
void *ThreadMain1(void *xxx)
{
...
}
until …
void *ThreadMain10(void *xxx)
{
...
}
But if I use the second method, I need to create just :
void *ThreadMain(void *xxx)
{
...
}
So which one is correct?
Thanks for your time and replies,
If the threads are doing the same tasks, they should use the same function (with different input maybe), so one ThreadMain is the correct way.