--- rpl/src/rpl.c 2010/04/28 07:05:38 1.21 +++ rpl/src/rpl.c 2010/05/16 19:36:20 1.24 @@ -447,6 +447,23 @@ rplinit(int argc, char *argv[], unsigned return(EXIT_FAILURE); } + if (sigaction(SIGFABORT, &action, NULL) != 0) + { + erreur = d_es_signal; + + if ((*s_etat_processus).langue == 'F') + { + printf("+++Système : Initialisation des signaux POSIX " + "impossible\n"); + } + else + { + printf("+++System : Initialization of POSIX signals failed\n"); + } + + return(EXIT_FAILURE); + } + action.sa_sigaction = interruption8; action.sa_flags = SA_NODEFER | SA_ONSTACK | SA_SIGINFO; @@ -1857,6 +1874,7 @@ rplinit(int argc, char *argv[], unsigned (*s_etat_processus).var_volatile_traitement_sigint = 0; (*s_etat_processus).var_volatile_recursivite = 0; (*s_etat_processus).var_volatile_exception_gsl = 0; + (*s_etat_processus).arret_depuis_abort = 0; initialisation_allocateur(s_etat_processus); initialisation_drapeaux(s_etat_processus); @@ -2623,7 +2641,10 @@ rplinit(int argc, char *argv[], unsigned if (erreur == d_absence_erreur) { - if ((*s_etat_processus).at_exit != NULL) + if (((*s_etat_processus).var_volatile_alarme == 0) + && ((*s_etat_processus).arret_depuis_abort + == 0) && ((*s_etat_processus).at_exit + != NULL)) { erreur = evaluation(s_etat_processus, (*s_etat_processus).at_exit, 'E'); @@ -2750,10 +2771,21 @@ rplinit(int argc, char *argv[], unsigned } else { - kill((*(*((struct_processus_fils *) - (*(*((struct_liste_chainee *) - l_element_courant)).donnee).objet)) - .thread).pid, SIGFSTOP); + if ((*s_etat_processus).arret_depuis_abort + == -1) + { + kill((*(*((struct_processus_fils *) + (*(*((struct_liste_chainee *) + l_element_courant)).donnee).objet)) + .thread).pid, SIGFABORT); + } + else + { + kill((*(*((struct_processus_fils *) + (*(*((struct_liste_chainee *) + l_element_courant)).donnee).objet)) + .thread).pid, SIGFSTOP); + } } } else @@ -2778,10 +2810,25 @@ rplinit(int argc, char *argv[], unsigned } else { - pthread_kill((*(*((struct_processus_fils *) - (*(*((struct_liste_chainee *) - l_element_courant)).donnee).objet)) - .thread).tid, SIGFSTOP); + if ((*s_etat_processus).arret_depuis_abort + == -1) + { + pthread_kill( + (*(*((struct_processus_fils *) + (*(*((struct_liste_chainee *) + l_element_courant)).donnee) + .objet)).thread).tid, + SIGFABORT); + } + else + { + pthread_kill( + (*(*((struct_processus_fils *) + (*(*((struct_liste_chainee *) + l_element_courant)).donnee) + .objet)).thread).tid, + SIGFSTOP); + } } } @@ -2814,13 +2861,6 @@ rplinit(int argc, char *argv[], unsigned l_element_courant = (void *) (*s_etat_processus).l_base_pile_processus; - if ((*s_etat_processus) - .nombre_interruptions_non_affectees != 0) - { - affectation_interruptions_logicielles( - s_etat_processus); - } - for(i = 0; i < (unsigned long) (*(*((struct_processus_fils *) (*(*((struct_liste_chainee *) @@ -2879,6 +2919,14 @@ rplinit(int argc, char *argv[], unsigned } pthread_mutex_unlock(&((*s_etat_processus).mutex)); + + if ((*s_etat_processus) + .nombre_interruptions_non_affectees != 0) + { + affectation_interruptions_logicielles( + s_etat_processus); + } + nanosleep(&attente, NULL); pthread_mutex_lock(&((*s_etat_processus).mutex)); } @@ -3423,7 +3471,6 @@ rplinit(int argc, char *argv[], unsigned # endif free((*s_etat_processus).localisation); - free(s_etat_processus); # ifndef SEMAPHORES_NOMMES sem_destroy(&semaphore_liste_threads); @@ -3441,8 +3488,11 @@ rplinit(int argc, char *argv[], unsigned sem_gestionnaires_signaux_atomique); # endif + free(s_etat_processus); + # ifdef DEBUG_MEMOIRE - debug_memoire_verification(s_etat_processus); + debug_memoire_verification(); + analyse_post_mortem(); # endif return((erreur == d_absence_erreur) ? EXIT_SUCCESS : EXIT_FAILURE);