I've been trying to create a simple thread that reads from stdin and stores input to a linked list. When creating and joining the thread I get the following error:
warning: passing argument 1 of ‘pthread_join’ makes integer from pointer without a cast [-Wint-conversion]
pthread_join(prod_thread, NULL);
I'm passing a thread_t* argument to pthread_join but it seems that it expects an int which confuses me. Can anyone explain why this is happening? Here is the code:
pair_t* head = malloc(sizeof(pair_t));
pthread_t* prod_thread = malloc(sizeof(pthread_t));
pthread_create(prod_thread, NULL, prod_func, head);
pthread_join(prod_thread, NULL);
The prod_func function looks like this:
void* prod_func(void* head) {
...
}
I've also tried calling pthread_join(&prod_thread, NULL);
but then I get the same error.