I cannot figure out how correctly pass my queue pointer to a pthread_create function.
Here is snippet of my code:
queue_t *queue_arr[number_of_categories];
int i = 0;
for(i = 0; i < number_of_categories; i++){
queue_arr[i] = queue_create();
}
trying to create thread with a pointer to a queue in a loop: //loop and some code here
if (pthread_create(&tid[i+1], NULL, consumer_thread, (void *)queue_arr[i]) != 0 ){
perror("pthread_create for consumer failed");
exit(-1);
};
it gives me a warning:
Incompatible pointer types passing 'void *(queue_t)' to parameter of type 'void *(*)(void *)'
Not sure how would I change queue_arr[i] in a correct manner for pthread_create.
Thanks for help guys
(void *)queue_arr[i]expression that the warning is about. Hint: Check theconsumer_threadfunction prototype/definition and see if you can find anything wrong with it. - Some programmer dude