I want to invoke a different function each time when I make a call to pthread_create. I have four different functions which performs some processing on an array input by user. e.g ascending order, descending order etc. How can I do this inside loop as shown below for one function only?
for (i = 0; i < num_threads; i++) {
param[i] = ... ; // Initialize parameter for thread i
if ( pthread_create(&tid[i], &attr, worker, & param[i]) != 0 ) {
printf("Cannot create thread\n");
exit(1);
}
}