Diff for /rpl/src/interruptions.c between versions 1.109 and 1.125

version 1.109, 2012/10/17 14:27:06 version 1.125, 2013/05/21 12:10:12
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.11    RPL/2 (R) version 4.1.14
   Copyright (C) 1989-2012 Dr. BERTRAND Joël    Copyright (C) 1989-2013 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 81  thread_surveillance_signaux(void *argume Line 81  thread_surveillance_signaux(void *argume
   
     volatile struct_liste_chainee_volatile  *l_element_courant;      volatile struct_liste_chainee_volatile  *l_element_courant;
   
       sigset_t                                set;
   
       sigfillset(&set);
       pthread_sigmask(SIG_BLOCK, &set, NULL);
   
     s_etat_processus = (struct_processus *) argument;      s_etat_processus = (struct_processus *) argument;
   
     for(;;)      for(;;)
Line 94  thread_surveillance_signaux(void *argume Line 99  thread_surveillance_signaux(void *argume
         if (sem_wait(semaphore_signalisation) == 0)          if (sem_wait(semaphore_signalisation) == 0)
 #       endif  #       endif
         {          {
             if ((*s_queue_signaux).requete_arret == d_vrai)  
             {  
                 break;  
             }  
   
 #           if (!defined(SEMAPHORES_NOMMES)) || defined(IPCS_SYSV)  #           if (!defined(SEMAPHORES_NOMMES)) || defined(IPCS_SYSV)
             sem_post(&(*s_queue_signaux).signalisation);              sem_post(&(*s_queue_signaux).signalisation);
 #           else  #           else
             sem_post(semaphore_signalisation);              sem_post(semaphore_signalisation);
 #           endif  #           endif
   
               if ((*s_queue_signaux).requete_arret == d_vrai)
               {
                   break;
               }
   
             nombre_signaux_envoyes = 0;              nombre_signaux_envoyes = 0;
             sched_yield();              sched_yield();
   
Line 544  liberation_threads(struct_processus *s_e Line 549  liberation_threads(struct_processus *s_e
   
     struct_processus                            *candidat;      struct_processus                            *candidat;
   
     unsigned long                               i;      struct_liste_variables_partagees            *l_element_partage_courant;
       struct_liste_variables_partagees            *l_element_partage_suivant;
   
       struct_liste_variables_statiques            *l_element_statique_courant;
       struct_liste_variables_statiques            *l_element_statique_suivant;
   
       integer8                                    i;
   
     void                                        *element_candidat;      void                                        *element_candidat;
     void                                        *element_courant;      void                                        *element_courant;
Line 587  liberation_threads(struct_processus *s_e Line 598  liberation_threads(struct_processus *s_e
             close((*s_etat_processus).pipe_injections);              close((*s_etat_processus).pipe_injections);
             close((*s_etat_processus).pipe_nombre_injections);              close((*s_etat_processus).pipe_nombre_injections);
             close((*s_etat_processus).pipe_interruptions);              close((*s_etat_processus).pipe_interruptions);
             close((*s_etat_processus).pipe_nombre_objets_attente);              close((*s_etat_processus).pipe_nombre_elements_attente);
             close((*s_etat_processus).pipe_nombre_interruptions_attente);  
   
             liberation(s_etat_processus, (*s_etat_processus).at_exit);              liberation(s_etat_processus, (*s_etat_processus).at_exit);
   
Line 656  liberation_threads(struct_processus *s_e Line 666  liberation_threads(struct_processus *s_e
                     close((*s_argument_thread).pipe_acquittement[1]);                      close((*s_argument_thread).pipe_acquittement[1]);
                     close((*s_argument_thread).pipe_injections[1]);                      close((*s_argument_thread).pipe_injections[1]);
                     close((*s_argument_thread).pipe_nombre_injections[1]);                      close((*s_argument_thread).pipe_nombre_injections[1]);
                     close((*s_argument_thread).pipe_nombre_objets_attente[0]);                      close((*s_argument_thread).pipe_nombre_elements_attente[0]);
                     close((*s_argument_thread).pipe_interruptions[0]);                      close((*s_argument_thread).pipe_interruptions[0]);
                     close((*s_argument_thread)  
                             .pipe_nombre_interruptions_attente[0]);  
   
                     if (pthread_mutex_unlock(&((*s_argument_thread)                      if (pthread_mutex_unlock(&((*s_argument_thread)
                             .mutex_nombre_references)) != 0)                              .mutex_nombre_references)) != 0)
Line 759  liberation_threads(struct_processus *s_e Line 767  liberation_threads(struct_processus *s_e
                 }                  }
             }              }
   
             liberation_arbre_variables(s_etat_processus,              // ne peut être effacé qu'une seule fois
                     (*s_etat_processus).s_arbre_variables, d_faux);  
   
             // Ne peut être effacé qu'une seule fois  
             if (suppression_variables_partagees == d_faux)              if (suppression_variables_partagees == d_faux)
             {              {
                 suppression_variables_partagees = d_vrai;                  suppression_variables_partagees = d_vrai;
   
                 for(i = 0; i < (*(*s_etat_processus)                  liberation_arbre_variables_partagees(s_etat_processus,
                         .s_liste_variables_partagees).nombre_variables; i++)                          (*(*s_etat_processus).s_arbre_variables_partagees));
                 {  
                     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)                  l_element_partage_courant = (*(*s_etat_processus)
                             .s_liste_variables_partagees).table[i].objet);                          .l_liste_variables_partagees);
                     free((*(*s_etat_processus).s_liste_variables_partagees)  
                             .table[i].nom);  
                 }  
   
                 if ((*(*s_etat_processus).s_liste_variables_partagees).table                  while(l_element_partage_courant != NULL)
                         != NULL)  
                 {                  {
                     free((struct_variable_partagee *) (*(*s_etat_processus)                      l_element_partage_suivant =
                             .s_liste_variables_partagees).table);                              (*l_element_partage_courant).suivant;
                       free(l_element_partage_courant);
                       l_element_partage_courant = l_element_partage_suivant;
                 }                  }
               }
   
               liberation_arbre_variables(s_etat_processus,
                       (*s_etat_processus).s_arbre_variables, d_faux);
   
               l_element_statique_courant = (*s_etat_processus)
                       .l_liste_variables_statiques;
   
                 pthread_mutex_trylock(&((*(*s_etat_processus)              while(l_element_statique_courant != NULL)
                         .s_liste_variables_partagees).mutex));              {
                 pthread_mutex_unlock(&((*(*s_etat_processus)                  l_element_statique_suivant =
                         .s_liste_variables_partagees).mutex));                      (*l_element_statique_courant).suivant;
                   free(l_element_statique_courant);
                   l_element_statique_courant = l_element_statique_suivant;
             }              }
   
             element_courant = (*s_etat_processus).l_base_pile;              element_courant = (*s_etat_processus).l_base_pile;
Line 1303  liberation_threads(struct_processus *s_e Line 1308  liberation_threads(struct_processus *s_e
             close((*s_argument_thread).pipe_acquittement[1]);              close((*s_argument_thread).pipe_acquittement[1]);
             close((*s_argument_thread).pipe_injections[1]);              close((*s_argument_thread).pipe_injections[1]);
             close((*s_argument_thread).pipe_nombre_injections[1]);              close((*s_argument_thread).pipe_nombre_injections[1]);
             close((*s_argument_thread).pipe_nombre_objets_attente[0]);              close((*s_argument_thread).pipe_nombre_elements_attente[0]);
             close((*s_argument_thread).pipe_interruptions[0]);              close((*s_argument_thread).pipe_interruptions[0]);
             close((*s_argument_thread).pipe_nombre_interruptions_attente[0]);  
   
             if (pthread_mutex_unlock(&((*s_argument_thread)              if (pthread_mutex_unlock(&((*s_argument_thread)
                     .mutex_nombre_references)) != 0)                      .mutex_nombre_references)) != 0)
Line 2401  signal_hup(struct_processus *s_etat_proc Line 2405  signal_hup(struct_processus *s_etat_proc
         return;          return;
     }      }
   
     snprintf(nom, 8 + 64 + 1, "rpl-out-%lu-%lu", (unsigned long) getpid(),      snprintf(nom, 8 + 64 + 1, "rpl-out-%llu-%llu",
             (unsigned long) pthread_self());              (unsigned long long) getpid(),
               (unsigned long long) pthread_self());
   
     if ((fichier = fopen(nom, "w+")) != NULL)      if ((fichier = fopen(nom, "w+")) != NULL)
     {      {
Line 2943  envoi_signal_thread(pthread_t tid, enum Line 2948  envoi_signal_thread(pthread_t tid, enum
   
     struct_processus                        *s_etat_processus;      struct_processus                        *s_etat_processus;
   
       if (pthread_mutex_lock(&mutex_interruptions) != 0)
       {
           pthread_mutex_unlock(&mutex_liste_threads);
           return(1);
       }
   
     if (pthread_mutex_lock(&mutex_liste_threads) != 0)      if (pthread_mutex_lock(&mutex_liste_threads) != 0)
     {      {
         return(1);          return(1);
Line 2966  envoi_signal_thread(pthread_t tid, enum Line 2977  envoi_signal_thread(pthread_t tid, enum
     {      {
         pthread_mutex_unlock(&mutex_liste_threads);          pthread_mutex_unlock(&mutex_liste_threads);
         return(1);          return(1);
     }  
   
     if (pthread_mutex_lock(&mutex_interruptions) != 0)  
     {  
         pthread_mutex_unlock(&mutex_liste_threads);  
         return(1);  
     }      }
   
     s_etat_processus = (*((struct_thread *) (*l_element_courant).donnee))      s_etat_processus = (*((struct_thread *) (*l_element_courant).donnee))

Removed from v.1.109  
changed lines
  Added in v.1.125


CVSweb interface <joel.bertrand@systella.fr>