--- rpl/src/instructions_p7.c 2019/02/09 13:36:40 1.79 +++ rpl/src/instructions_p7.c 2019/02/11 09:45:51 1.80 @@ -752,8 +752,15 @@ instruction_poke(struct_processus *s_eta action.sa_handler = SIG_IGN; action.sa_flags = 0; + if (pthread_mutex_lock(&mutex_sigaction) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + if (sigaction(SIGPIPE, &action, ®istre) != 0) { + pthread_mutex_unlock(&mutex_sigaction); pthread_mutex_unlock(&((*s_etat_processus) .mutex_pile_processus)); @@ -785,12 +792,14 @@ instruction_poke(struct_processus *s_eta if ((*s_etat_processus).erreur_systeme != d_es) { + pthread_mutex_unlock(&mutex_sigaction); pthread_mutex_unlock(&((*s_etat_processus) .mutex_pile_processus)); return; } } + /* # ifndef SEMAPHORES_NOMMES if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) @@ -798,9 +807,11 @@ instruction_poke(struct_processus *s_eta if (sem_post((*s_etat_processus).semaphore_fork) != 0) # endif { + pthread_mutex_unlock(&mutex_sigaction); (*s_etat_processus).erreur_systeme = d_es_processus; return; } + */ while((longueur_ecriture = write_atomic(s_etat_processus, (*(*((struct_processus_fils *) @@ -808,6 +819,7 @@ instruction_poke(struct_processus *s_eta .pipe_nombre_injections[1], "-", sizeof(unsigned char))) != sizeof(unsigned char)) { + /* # ifndef SEMAPHORES_NOMMES while(sem_wait( &((*s_etat_processus).semaphore_fork)) != 0) @@ -823,9 +835,11 @@ instruction_poke(struct_processus *s_eta return; } } + */ if (longueur_ecriture == -1) { + pthread_mutex_unlock(&mutex_sigaction); pthread_mutex_unlock(&((*s_etat_processus) .mutex_pile_processus)); @@ -854,6 +868,7 @@ instruction_poke(struct_processus *s_eta if (sigaction(SIGPIPE, ®istre, NULL) != 0) { + pthread_mutex_unlock(&mutex_sigaction); (*s_etat_processus).erreur_systeme = d_es_signal; return; @@ -862,6 +877,7 @@ instruction_poke(struct_processus *s_eta return; } + /* # ifndef SEMAPHORES_NOMMES if (sem_post( &((*s_etat_processus).semaphore_fork)) != 0) @@ -873,6 +889,7 @@ instruction_poke(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + */ } if (ecriture_pipe(s_etat_processus, @@ -889,6 +906,7 @@ instruction_poke(struct_processus *s_eta } } + /* # ifndef SEMAPHORES_NOMMES while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) @@ -902,6 +920,7 @@ instruction_poke(struct_processus *s_eta return; } } + */ if (registre_stop == 0) { @@ -923,6 +942,7 @@ instruction_poke(struct_processus *s_eta if (sigaction(SIGPIPE, ®istre, NULL) != 0) { + pthread_mutex_unlock(&mutex_sigaction); pthread_mutex_unlock(&((*s_etat_processus) .mutex_pile_processus)); @@ -930,6 +950,12 @@ instruction_poke(struct_processus *s_eta return; } + if (pthread_mutex_unlock(&mutex_sigaction) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + break; } } @@ -956,11 +982,18 @@ instruction_poke(struct_processus *s_eta // de lecteur et on peut se prendre un SIGPIPE dans la // figure ! + if (pthread_mutex_lock(&mutex_sigaction) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + action.sa_handler = SIG_IGN; action.sa_flags = 0; if (sigaction(SIGPIPE, &action, ®istre) != 0) { + pthread_mutex_unlock(&mutex_sigaction); pthread_mutex_unlock(&((*s_etat_processus) .mutex_pile_processus)); @@ -976,6 +1009,7 @@ instruction_poke(struct_processus *s_eta (*(*l_element_courant).donnee).objet)).thread) .mutex)) != 0) { + pthread_mutex_unlock(&mutex_sigaction); (*s_etat_processus).erreur_systeme = d_es_processus; return; } @@ -996,6 +1030,7 @@ instruction_poke(struct_processus *s_eta (*(*l_element_courant).donnee).objet)) .thread).mutex)) != 0) { + pthread_mutex_unlock(&mutex_sigaction); (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -1011,6 +1046,7 @@ instruction_poke(struct_processus *s_eta (*(*l_element_courant).donnee).objet)) .thread).mutex)) != 0) { + pthread_mutex_unlock(&mutex_sigaction); (*s_etat_processus).erreur_systeme = d_es_processus; return; } @@ -1022,6 +1058,7 @@ instruction_poke(struct_processus *s_eta (*(*l_element_courant).donnee).objet)).thread) .mutex)) != 0) { + pthread_mutex_unlock(&mutex_sigaction); (*s_etat_processus).erreur_systeme = d_es_processus; return; } @@ -1038,12 +1075,14 @@ instruction_poke(struct_processus *s_eta if ((*s_etat_processus).erreur_systeme != d_es) { + pthread_mutex_unlock(&mutex_sigaction); pthread_mutex_unlock(&((*s_etat_processus) .mutex_pile_processus)); return; } } + /* # ifndef SEMAPHORES_NOMMES if (sem_post( &((*s_etat_processus).semaphore_fork)) != 0) @@ -1055,6 +1094,7 @@ instruction_poke(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + */ while((longueur_ecriture = write_atomic(s_etat_processus, (*(*((struct_processus_fils *) @@ -1062,6 +1102,7 @@ instruction_poke(struct_processus *s_eta .pipe_nombre_injections[1], "-", sizeof(unsigned char))) != sizeof(unsigned char)) { + /* # ifndef SEMAPHORES_NOMMES while(sem_wait( &((*s_etat_processus).semaphore_fork)) != 0) @@ -1077,6 +1118,7 @@ instruction_poke(struct_processus *s_eta return; } } + */ if (longueur_ecriture == -1) { @@ -1108,14 +1150,17 @@ instruction_poke(struct_processus *s_eta if (sigaction(SIGPIPE, ®istre, NULL) != 0) { + pthread_mutex_unlock(&mutex_sigaction); (*s_etat_processus).erreur_systeme = d_es_signal; return; } + pthread_mutex_unlock(&mutex_sigaction); return; } + /* # ifndef SEMAPHORES_NOMMES if (sem_post( &((*s_etat_processus).semaphore_fork)) != 0) @@ -1127,6 +1172,7 @@ instruction_poke(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + */ } if (ecriture_pipe(s_etat_processus, @@ -1143,6 +1189,7 @@ instruction_poke(struct_processus *s_eta } } + /* # ifndef SEMAPHORES_NOMMES while(sem_wait( &((*s_etat_processus).semaphore_fork)) != 0) @@ -1157,6 +1204,7 @@ instruction_poke(struct_processus *s_eta return; } } + */ if (registre_stop == 0) { @@ -1178,6 +1226,7 @@ instruction_poke(struct_processus *s_eta if (sigaction(SIGPIPE, ®istre, NULL) != 0) { + pthread_mutex_unlock(&mutex_sigaction); pthread_mutex_unlock(&((*s_etat_processus) .mutex_pile_processus)); @@ -1185,6 +1234,12 @@ instruction_poke(struct_processus *s_eta return; } + if (pthread_mutex_unlock(&mutex_sigaction) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + break; } }