Diff for /rpl/src/instructions_m4.c between versions 1.28 and 1.46

version 1.28, 2011/07/22 07:38:38 version 1.46, 2012/10/04 15:21:26
Line 1 Line 1
 /*  /*
 ================================================================================  ================================================================================
   RPL/2 (R) version 4.1.1    RPL/2 (R) version 4.1.11
   Copyright (C) 1989-2011 Dr. BERTRAND Joël    Copyright (C) 1989-2012 Dr. BERTRAND Joël
   
   This file is part of RPL/2.    This file is part of RPL/2.
   
Line 169  instruction_mem(struct_processus *s_etat Line 169  instruction_mem(struct_processus *s_etat
   
     free(tableau);      free(tableau);
   
   #warning A FIXER
       /*
     for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++)      for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++)
     {      {
         // Comptabilisation des empreintes mémoire des variables          // Comptabilisation des empreintes mémoire des variables
Line 187  instruction_mem(struct_processus *s_etat Line 189  instruction_mem(struct_processus *s_etat
                     .s_liste_variables_statiques[i].objet);                      .s_liste_variables_statiques[i].objet);
         }          }
     }      }
       */
   
     for(i = 0; i < (*(*s_etat_processus).s_liste_variables_partagees)      for(i = 0; i < (*(*s_etat_processus).s_liste_variables_partagees)
             .nombre_variables; i++)              .nombre_variables; i++)
Line 417  instruction_mtxlock(struct_processus *s_ Line 420  instruction_mtxlock(struct_processus *s_
         }          }
   
 #       ifndef SEMAPHORES_NOMMES  #       ifndef SEMAPHORES_NOMMES
         if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)              if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0)
         {  
             (*s_etat_processus).erreur_systeme = d_es_processus;  
             return;  
         }  
 #       else  #       else
         if (sem_post((*s_etat_processus).semaphore_fork) != 0)              if (sem_post((*s_etat_processus).semaphore_fork) != 0)
   #       endif
         {          {
             (*s_etat_processus).erreur_systeme = d_es_processus;              (*s_etat_processus).erreur_systeme = d_es_processus;
             return;              return;
         }          }
 #       endif  
   
         if (pthread_mutex_lock(&((*((struct_mutex *) (*s_objet_argument).objet))          if (pthread_mutex_lock(&((*((struct_mutex *) (*s_objet_argument).objet))
                 .mutex)) != 0)                  .mutex)) != 0)
         {          {
 #           ifndef SEMAPHORES_NOMMES  #           ifndef SEMAPHORES_NOMMES
             while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)                  while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
 #           else  #           else
             while(sem_wait((*s_etat_processus).semaphore_fork) == -1)                  while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
 #           endif  #           endif
             {              {
                 if ((*s_etat_processus).profilage == d_vrai)  
                 {  
                     profilage(s_etat_processus, NULL);  
                 }  
   
                 if (errno != EINTR)                  if (errno != EINTR)
                 {                  {
                     (*s_etat_processus).erreur_systeme = d_es_processus;                      (*s_etat_processus).erreur_systeme = d_es_processus;
Line 462  instruction_mtxlock(struct_processus *s_ Line 456  instruction_mtxlock(struct_processus *s_
             return;              return;
         }          }
   
           (*((struct_mutex *) (*s_objet_argument).objet)).tid = pthread_self();
   
 #       ifndef SEMAPHORES_NOMMES  #       ifndef SEMAPHORES_NOMMES
         while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1)              while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0)
 #       else  #       else
         while(sem_wait((*s_etat_processus).semaphore_fork) == -1)              while(sem_wait((*s_etat_processus).semaphore_fork) != 0)
 #       endif  #       endif
         {          {
             if (errno != EINTR)              if (errno != EINTR)
Line 617  instruction_mtxtrylock(struct_processus Line 613  instruction_mtxtrylock(struct_processus
                 return;                  return;
             }              }
         }          }
           else
           {
               (*((struct_mutex *) (*s_objet_argument).objet)).tid =
                       pthread_self();
           }
   
         if ((*s_etat_processus).profilage == d_vrai)          if ((*s_etat_processus).profilage == d_vrai)
         {          {
Line 640  instruction_mtxtrylock(struct_processus Line 641  instruction_mtxtrylock(struct_processus
         return;          return;
     }      }
   
     (*((integer8 *) (*s_objet_resultat).objet)) = (ios == 0) ? 0 : -1;      (*((integer8 *) (*s_objet_resultat).objet)) = (ios == 0) ? -1 : 0;
   
     if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),      if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
             s_objet_resultat) == d_erreur)              s_objet_resultat) == d_erreur)
Line 651  instruction_mtxtrylock(struct_processus Line 652  instruction_mtxtrylock(struct_processus
     return;      return;
 }  }
   
   
 /*  /*
 ================================================================================  ================================================================================
   Fonction 'mtxstatus'    Fonction 'mtxstatus'
Line 775  instruction_mtxstatus(struct_processus * Line 777  instruction_mtxstatus(struct_processus *
             }              }
         }          }
   
         if (pthread_mutex_unlock(&((*((struct_mutex *)          if (ios == 0)
                 (*s_objet_argument).objet)).mutex)) != 0)  
         {          {
             liberation(s_etat_processus, s_objet_argument);              // Le mutex a été verrouillé par le trylock précédent.
   
             if ((*s_etat_processus).profilage == d_vrai)              if (pthread_mutex_unlock(&((*((struct_mutex *)
                       (*s_objet_argument).objet)).mutex)) != 0)
             {              {
                 profilage(s_etat_processus, NULL);                  liberation(s_etat_processus, s_objet_argument);
             }  
   
             (*s_etat_processus).erreur_systeme = d_es_processus;                  if ((*s_etat_processus).profilage == d_vrai)
             return;                  {
                       profilage(s_etat_processus, NULL);
                   }
   
                   (*s_etat_processus).erreur_systeme = d_es_processus;
                   return;
               }
         }          }
   
         if ((*s_etat_processus).profilage == d_vrai)          if ((*s_etat_processus).profilage == d_vrai)
Line 900  instruction_mtxunlock(struct_processus * Line 907  instruction_mtxunlock(struct_processus *
   
         if (l_element_courant == NULL)          if (l_element_courant == NULL)
         {          {
               liberation(s_etat_processus, s_objet_argument);
   
             (*s_etat_processus).erreur_execution = d_ex_mutex;              (*s_etat_processus).erreur_execution = d_ex_mutex;
               return;
           }
   
           if (pthread_equal(pthread_self(), (*((struct_mutex *)
                   (*s_objet_argument).objet)).tid) == 0)
           {
             liberation(s_etat_processus, s_objet_argument);              liberation(s_etat_processus, s_objet_argument);
   
               (*s_etat_processus).erreur_execution =
                       d_ex_mutex_acquis_autre_thread;
             return;              return;
         }          }
   

Removed from v.1.28  
changed lines
  Added in v.1.46


CVSweb interface <joel.bertrand@systella.fr>