Se worker è il nome della funzione che il thread deve eseguire, non devi passarne l'indirizzo con la &. Inoltre, leggi attentamente la documentazione della pthread_create():
non è detto che, in caso di errore, la pthread_create() restituisca -1, è certo solo che restituisce un valore diverso da 0, pertanto modifica il controllo dell'errore con...
RETURN VALUE
On success, pthread_create() returns 0; on error, it returns an error number, and the contents of *thread are undefined.
...
ammesso poi che acp sia corretto come argomento, cosa che non si può stabilire dallo snippet che hai postato.codice:thread = pthread_create(&t_id, NULL, worker, (void*)acp); if (thread) { perror("Crezione thread"); return -1; }

Rispondi quotando