Привет, ребята, у меня возникают проблемы с этим кодомC Тем создание выпуск
int file_id;
void* wraper(void* p){
return (void)reader((int)p);
}
int main(int argc, char *argv[]){
srandom ((unsigned) time(NULL));
int i;
pthread_t tid[3];
for(i=0;i<3;i++){
pthread_t * temp = malloc(sizeof(tid[i]));
file_id=get_random(NB_FILES);
pthread_create(&tid[i], NULL,wraper,(void*)file_id);
}
и компилятор дает мне этот
reader-thread.c: In function ‘wraper’:
reader-thread.c:59:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
return (void)reader((int)p);
^
reader-thread.c:59:5: error: void value not ignored as it ought to be
return (void)reader((int)p);
^
reader-thread.c: In function ‘main’:
reader-thread.c:70:46: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
pthread_create(&tid[i], NULL,wraper,(void*)file_id);
^
Цель состоит в том, чтобы создать 3 темы и отправить их file_id к читателю функции, я не вижу, что я делаю неправильно
И как объявляется 'reader()'? И почему вы возвращаете значение, которое вы наложили на 'void' ?! – unwind
читатель объявляется с читателем (int file) {...} –