--- rpl/src/rpl.h 2012/12/14 14:19:50 1.186 +++ rpl/src/rpl.h 2012/12/18 10:20:24 1.188 @@ -445,7 +445,10 @@ union semun __STATIC_MUTEX_INITIALIZATION__; __EXTERN__ pthread_mutex_t mutex_gestionnaires_signaux_atomique __STATIC_MUTEX_INITIALIZATION__; + __EXTERN__ pthread_mutex_t mutex_creation_variable_partagee + __STATIC_MUTEX_INITIALIZATION__; __EXTERN__ pthread_mutex_t mutex_sections_critiques; + __EXTERN__ pthread_mutex_t mutex_liste_variables_partagees; __EXTERN__ sem_t __PTR__ semaphore_gestionnaires_signaux; @@ -742,7 +745,7 @@ pid_t debug_fork(); Erreurs système -------------------------------------------------------------------------------- */ - +#define DEBUG_ERREURS #ifdef DEBUG_ERREURS # ifdef MESSAGES # define __erreur(i) i @@ -1738,11 +1741,25 @@ typedef struct arbre_variables struct liste_variables *feuille; struct liste_variables_statiques *feuille_statique; - struct liste_variables_partagees **feuille_partagee; - - pthread_mutex_t mutex_feuille_partagee; } struct_arbre_variables; +typedef struct arbre_variables_partagees +{ + unsigned int noeuds_utilises; + // Nombre de noeuds utilisés dans le + // tableau **noeuds + signed int indice_tableau_pere; + // Position de la structure dans le + // tableau **noeuds du père + + struct arbre_variables_partagees *noeud_pere; + struct arbre_variables_partagees **noeuds; + + struct liste_variables_partagees *feuille; + + pthread_mutex_t mutex_feuille; +} struct_arbre_variables_partagees; + #define INITIALISATION_MUTEX(mutex) \ do { \ pthread_mutexattr_t attributs_mutex; \ @@ -1801,8 +1818,10 @@ typedef struct liste_variables_partagees struct liste_variables_partagees *suivant; struct liste_variables_partagees *precedent; struct liste_variables_partagees *reference; - struct_arbre_variables *feuille; + struct_arbre_variables_partagees *feuille; struct_variable_partagee *variable; + pthread_t tid; + pid_t pid; } struct_liste_variables_partagees; #endif @@ -1923,8 +1942,11 @@ typedef struct processus struct_liste_variables *l_liste_variables_par_niveau; struct_liste_variables_statiques *l_liste_variables_statiques; + + struct_arbre_variables_partagees + **s_arbre_variables_partagees; struct_liste_variables_partagees - *l_liste_variables_partagees; + **l_liste_variables_partagees; logical1 niveau_supprime; @@ -2306,6 +2328,10 @@ typedef struct processus struct_arbre_variables *variables_noeud[TAILLE_CACHE]; int pointeur_variables_noeud; + struct_arbre_variables_partagees + *variables_partagees_noeud[TAILLE_CACHE]; + int pointeur_variables_partagees_noeud; + struct_liste_variables *variables_feuille[TAILLE_CACHE]; int pointeur_variables_feuille; @@ -2314,6 +2340,11 @@ typedef struct processus struct_arbre_variables **variables_tableau_noeuds[TAILLE_CACHE]; int pointeur_variables_tableau_noeuds; + + struct_arbre_variables_partagees + **variables_tableau_noeuds_partages + [TAILLE_CACHE]; + int pointeur_variables_tableau_noeuds_partages; } struct_processus; #endif @@ -2994,9 +3025,11 @@ void liberation_arbre_instructions(struc void liberation_arbre_variables(struct_processus *s_etat_processus, struct_arbre_variables *arbre, logical1 definitions); void liberation_arbre_variables_partagees(struct_processus *s_etat_processus, - struct_arbre_variables *arbre); + struct_arbre_variables_partagees *arbre); void liberation_contexte_cas(struct_processus *s_etat_processus); void liberation_generateur_aleatoire(struct_processus *s_etat_processus); +void liberation_mutexes_arbre_variables_partagees(struct_processus + *s_etat_processus, struct_arbre_variables_partagees *l_element_courant); void liberation_threads(struct_processus *s_etat_processus); void liberation_profil(struct_processus *s_etat_processus); void localisation_courante(struct_processus *s_etat_processus); @@ -3257,9 +3290,6 @@ logical1 recherche_variable(struct_proce unsigned char *nom_variable); logical1 recherche_variable_globale(struct_processus *s_etat_processus, unsigned char *nom_variable); -logical1 recherche_variable_partagee(struct_processus *s_etat_processus, - unsigned char *nom_variable, union_position_variable position, - unsigned char origine); logical1 test_cfsf(struct_processus *s_etat_processus, unsigned char indice_drapeau); logical1 test_expression_rpn(unsigned char *chaine); @@ -3290,10 +3320,8 @@ int alsprintf(unsigned char **strp, cons int interruption_violation_access(void *adresse_fautive, int gravite); #ifndef RPLARGS int liste_variables(struct_processus *s_etat_processus, - struct_tableau_variables *tableau, int position, - struct_arbre_variables *l_element_courant); -int nombre_variables(struct_processus *s_etat_processus, - struct_arbre_variables *l_element_courant); + struct_tableau_variables *tableau); +int nombre_variables(struct_processus *s_etat_processus); int readline_analyse_syntaxique(int count, int key); int readline_effacement(int count, int key); #endif @@ -3398,13 +3426,16 @@ struct_arbre_variables **allocation_tabl /* -------------------------------------------------------------------------------- Fonctions renvoyant un pointeur sur une *struct_liste_variables_statiques + ou *struct_liste_variables_partagees -------------------------------------------------------------------------------- */ struct_liste_variables_statiques *recherche_variable_statique(struct_processus *s_etat_processus, unsigned char *nom_variable, - union_position_variable position, - unsigned char origine); + union_position_variable position, unsigned char origine); +struct_liste_variables_partagees *recherche_variable_partagee(struct_processus + *s_etat_processus, unsigned char *nom_variable, + union_position_variable position, unsigned char origine); #endif /*