noodles83
09-06-2009, 15:28
Ottengo un warning compilando con "-Wall -pedantic"
warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type
non capisco dove sia il problema, mi dareste una mano per capire dove sbaglio? vi riporto un pezzo di codice...
void* work_func(sthread_t* info);
int main(int argc, char* argv[]){
......
array[threadIndex].index=threadIndex;
array[threadIndex].ch=clientSocket;
array[threadIndex].dir=mydir;
array[threadIndex].dir_name=argv[1];
if(pthread_create(&(array[threadIndex].id),NULL, work_func, (sthread_t*)&array[threadIndex])!=0){
fprintf(stderr,"Errore: dserver/pthread_create\n");
exit(EXIT_FAILURE);
}else {
printf("%d) Creating new thread for a new client\n",threadIndex);
threadIndex++;
}
.....
}
poche righe sotto... c'è la funzione del thread.
/*FUNZIONE dei THREADS DEDICATI*/
void* work_func(sthread_t* info){
// corpo della funzione
pthread_exit(NULL);
}
:confused:
warning: passing argument 3 of ‘pthread_create’ from incompatible pointer type
non capisco dove sia il problema, mi dareste una mano per capire dove sbaglio? vi riporto un pezzo di codice...
void* work_func(sthread_t* info);
int main(int argc, char* argv[]){
......
array[threadIndex].index=threadIndex;
array[threadIndex].ch=clientSocket;
array[threadIndex].dir=mydir;
array[threadIndex].dir_name=argv[1];
if(pthread_create(&(array[threadIndex].id),NULL, work_func, (sthread_t*)&array[threadIndex])!=0){
fprintf(stderr,"Errore: dserver/pthread_create\n");
exit(EXIT_FAILURE);
}else {
printf("%d) Creating new thread for a new client\n",threadIndex);
threadIndex++;
}
.....
}
poche righe sotto... c'è la funzione del thread.
/*FUNZIONE dei THREADS DEDICATI*/
void* work_func(sthread_t* info){
// corpo della funzione
pthread_exit(NULL);
}
:confused: