Bonjour,
Je réalise le code suivant qui semble trés basic et qui me génére systématiquement une erreur du type "Critical system error" au moment du pthread_create. J'ai beau débugger et chercher je ne vois vraiment pas ou est le probléme.
Si quelqu'un arrive à voir ce qui se passe, ca fait 2 heures que je suis là dessus
Merci d'avance
L'affichage donne ca:
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 struct dataE { int n,npoint; double *cord,*loss; } my_structE; void *myThreadE(void *arg) { struct dataE *d; d = (struct dataE *)arg; printf("start:%d\n",d->n); pthread_exit(NULL); return(NULL); } void fonction() { int i,rc,Nthr=2; pthread_attr_t *thAttr[Nthr]; pthread_t tid[Nthr]; void *status; struct dataE d[Nthr]; for (i=0;i<Nthr;i++) { thAttr[Nthr]=NULL; d[i].n=i; d[i].npoint=i*2; d[i].cord=NULL; d[i].loss=NULL; } for (i=0;i<Nthr;i++) { pthread_create(&tid[i], thAttr[i], myThreadE, (void *)&d[i]); } for(i=0; i<Nthr; i++) { rc = pthread_join(tid[i],&status); if (rc) { char lig[1000]; sprintf(lig,"ERROR: return code from pthread_join() is %d\n",rc); exitc_(lig,0); } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4start:1 Critical system error: Resource temporarily unavailable
Partager