--- rpl/src/instructions_c6.c 2011/04/21 16:00:56 1.18 +++ rpl/src/instructions_c6.c 2011/09/26 15:57:12 1.31 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.1.0.prerelease.0 + RPL/2 (R) version 4.1.4 Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -38,7 +38,7 @@ void instruction_clusr(struct_processus *s_etat_processus) { - unsigned long i; + struct_liste_variables *l_element_courant; (*s_etat_processus).erreur_execution = d_ex; @@ -73,18 +73,50 @@ instruction_clusr(struct_processus *s_et } } - for(i = 0; i < (*s_etat_processus).nombre_variables; i++) + l_element_courant = (*s_etat_processus).l_liste_variables_par_niveau; + + if (l_element_courant == NULL) + { + return; + } + + do { - if (((*s_etat_processus).s_liste_variables[i]).niveau == 1) + if ((*l_element_courant).liste != NULL) { - if (retrait_variable(s_etat_processus, - ((*s_etat_processus).s_liste_variables[i]).nom, 'G') - == d_erreur) + if ((*(*l_element_courant).liste).donnee != NULL) { - return; + if ((*((struct_variable *) (*(*l_element_courant).liste) + .donnee)).niveau == 1) + { + while((*l_element_courant).liste != NULL) + { + if (retrait_variable(s_etat_processus, + (*((struct_variable *) (*(*l_element_courant) + .liste).donnee)).nom, 'G') == d_erreur) + { + return; + } + + if ((*s_etat_processus).niveau_supprime == d_vrai) + { + // La dernière variable de niveau 1 a été + // supprimée. On sort donc de la boucle car + // (*l_element_courant).liste pointe sur + // un pointeur libérée par retrait_variable(). + + break; + } + } + + break; + } } } - } + + l_element_courant = (*l_element_courant).precedent; + } while(l_element_courant != (*s_etat_processus) + .l_liste_variables_par_niveau); return; } @@ -576,8 +608,10 @@ instruction_continue(struct_processus *s .thread).pid == (*(*((struct_processus_fils *) (*(*l_element_courant).donnee).objet)).thread).pid) { - if (kill((*(*((struct_processus_fils *) - (*s_objet).objet)).thread).pid, SIGCONT) != 0) + if (envoi_signal_processus( + (*(*((struct_processus_fils *) + (*s_objet).objet)).thread).pid, rpl_sigcont) + != 0) { // Le processus est peut-être dans l'état zombie. } @@ -607,8 +641,9 @@ instruction_continue(struct_processus *s (*(*l_element_courant).donnee).objet)).thread) .pid)) { - if (pthread_kill((*(*((struct_processus_fils *) - (*s_objet).objet)).thread).tid, SIGCONT) + if (envoi_signal_thread( + (*(*((struct_processus_fils *) + (*s_objet).objet)).thread).tid, rpl_sigcont) != 0) { // Le thread est peut-être dans l'état zombie.