Bonsoir je cherche a crée un fonction qui me crée un thread pour la fonction passé en paramètre, j'ai fait ceci :
dans mon main :
mais voila ca ne fonctionne pas ! j'ai comme message d'erreur passing argument 3 of pthread_create from incompatible pointer type
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 //crée un thread pour un nouveau programme int v2_nouveau_programme(void (*nouv_prog)()){ pthread_t thread; if(pthread_create(&thread, NULL, nouv_prog, NULL) == -1) { perror("pthread_create"); return EXIT_FAILURE; } return EXIT_SUCCESS; } //le nouveau programme void *mon_programme_1(void *arg) { printf("nous sommes dans le thread 1\n"); v2_rotate(0,90); (void) arg; pthread_exit(NULL); } int main(){ v2_nouveau_programme(mon_programme_1); return 0; }
pourtant je pense avoir passer correctement mes arguments à pthread_create !!!
Partager