--- rpl/src/interruptions.c 2012/10/14 21:37:11 1.106 +++ rpl/src/interruptions.c 2012/12/13 16:59:42 1.110 @@ -91,7 +91,7 @@ thread_surveillance_signaux(void *argume # if (!defined(SEMAPHORES_NOMMES)) || defined(IPCS_SYSV) if (sem_wait(&(*s_queue_signaux).signalisation) == 0) # else - if(sem_wait(semaphore_signalisation) == 0) + if (sem_wait(semaphore_signalisation) == 0) # endif { if ((*s_queue_signaux).requete_arret == d_vrai) @@ -173,7 +173,10 @@ thread_surveillance_signaux(void *argume } else { - (*s_etat_processus).erreur_systeme = d_es_processus; + if (errno != EINTR) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + } } } @@ -332,10 +335,17 @@ retrait_thread(struct_processus *s_etat_ .pointeur_signal_lecture) { # if (!defined(SEMAPHORES_NOMMES)) || defined(IPCS_SYSV) - sem_wait(&((*s_queue_signaux).signalisation)); + while(sem_wait(&((*s_queue_signaux).signalisation)) != 0) # else - sem_wait(semaphore_signalisation); + while(sem_wait(semaphore_signalisation) != 0) # endif + { + if (errno != EINTR) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + } (*(*((struct_thread *) (*l_element_courant).donnee)).s_etat_processus) .pointeur_signal_lecture = ((*(*((struct_thread *) @@ -749,43 +759,18 @@ liberation_threads(struct_processus *s_e } } - liberation_arbre_variables(s_etat_processus, - (*s_etat_processus).s_arbre_variables, d_faux); - - // Ne peut être effacé qu'une seule fois + // ne peut être effacé qu'une seule fois if (suppression_variables_partagees == d_faux) { suppression_variables_partagees = d_vrai; - for(i = 0; i < (*(*s_etat_processus) - .s_liste_variables_partagees).nombre_variables; i++) - { - pthread_mutex_trylock(&((*(*(*s_etat_processus) - .s_liste_variables_partagees).table[i].objet) - .mutex)); - pthread_mutex_unlock(&((*(*(*s_etat_processus) - .s_liste_variables_partagees).table[i].objet) - .mutex)); - - liberation(s_etat_processus, (*(*s_etat_processus) - .s_liste_variables_partagees).table[i].objet); - free((*(*s_etat_processus).s_liste_variables_partagees) - .table[i].nom); - } - - if ((*(*s_etat_processus).s_liste_variables_partagees).table - != NULL) - { - free((struct_variable_partagee *) (*(*s_etat_processus) - .s_liste_variables_partagees).table); - } - - pthread_mutex_trylock(&((*(*s_etat_processus) - .s_liste_variables_partagees).mutex)); - pthread_mutex_unlock(&((*(*s_etat_processus) - .s_liste_variables_partagees).mutex)); + liberation_arbre_variables_partagees(s_etat_processus, + (*s_etat_processus).s_arbre_variables); } + liberation_arbre_variables(s_etat_processus, + (*s_etat_processus).s_arbre_variables, d_faux); + element_courant = (*s_etat_processus).l_base_pile; while(element_courant != NULL) { @@ -2501,11 +2486,11 @@ envoi_interruptions(struct_processus *s_ default: if ((*s_etat_processus).langue == 'F') { - printf("+++System : Spurious signal (%d) !\n", signal); + printf("+++System : Signal inconnu (%d) !\n", signal); } else { - printf("+++System : Signal inconnu (%d) !\n", signal); + printf("+++System : Spurious signal (%d) !\n", signal); } break; @@ -2545,10 +2530,17 @@ scrutation_interruptions(struct_processu % LONGUEUR_QUEUE_SIGNAUX; # if (!defined(SEMAPHORES_NOMMES)) || defined(IPCS_SYSV) - sem_wait(&((*s_queue_signaux).signalisation)); + while(sem_wait(&((*s_queue_signaux).signalisation)) != 0) # else - sem_wait(semaphore_signalisation); + while(sem_wait(semaphore_signalisation) != 0) # endif + { + if (errno != EINTR) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + } } # if (!defined(SEMAPHORES_NOMMES)) || defined(IPCS_SYSV) @@ -2576,10 +2568,17 @@ scrutation_interruptions(struct_processu % LONGUEUR_QUEUE_SIGNAUX; # if (!defined(SEMAPHORES_NOMMES)) || defined(IPCS_SYSV) - sem_wait(&((*s_queue_signaux).signalisation)); + while(sem_wait(&((*s_queue_signaux).signalisation)) != 0) # else - sem_wait(semaphore_signalisation); + while(sem_wait(semaphore_signalisation) != 0) # endif + { + if (errno != EINTR) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + } } pthread_mutex_unlock(&mutex_interruptions);