--- rpl/src/instructions_f1.c 2013/03/20 17:11:45 1.53 +++ rpl/src/instructions_f1.c 2013/09/06 10:30:53 1.59 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.1.13 + RPL/2 (R) version 4.1.16 Copyright (C) 1989-2013 Dr. BERTRAND Joël This file is part of RPL/2. @@ -53,6 +53,8 @@ instruction_fleche(struct_processus *s_e logical1 fin_scrutation; logical1 presence_expression_algebrique; + pthread_mutexattr_t attributs_mutex; + union_position_variable position_variable; unsigned char instruction_valide; @@ -339,13 +341,13 @@ instruction_fleche(struct_processus *s_e { if ((*s_etat_processus).langue == 'F') { - printf("[%d] Nombre de variables de niveau %lu : %lu\n", + printf("[%d] Nombre de variables de niveau %lld : %lld\n", (int) getpid(), (*s_etat_processus).niveau_courant, nombre_variables); } else { - printf("[%d] Number of level %lu variables : %lu\n", + printf("[%d] Number of level %lld variables : %lld\n", (int) getpid(), (*s_etat_processus).niveau_courant, nombre_variables); } @@ -593,20 +595,13 @@ instruction_fleche(struct_processus *s_e } else { - // Variable partagee à créer + // Variable partagée à créer (*s_etat_processus).erreur_systeme = d_es; if ((s_variable_partagee.nom = malloc((strlen(s_variable.nom) + 1) * sizeof(unsigned char))) == NULL) { - if (pthread_mutex_unlock(&((*(*s_etat_processus) - .pointeur_variable_partagee_courante).mutex)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - (*s_etat_processus).erreur_systeme = d_es_allocation_memoire; return; @@ -647,6 +642,15 @@ instruction_fleche(struct_processus *s_e (*s_etat_processus).objet_courant; } + // Création du mutex + + pthread_mutexattr_init(&attributs_mutex); + pthread_mutexattr_settype(&attributs_mutex, + PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&(s_variable_partagee.mutex), + &attributs_mutex); + pthread_mutexattr_destroy(&attributs_mutex); + s_variable_partagee.objet = (*l_emplacement_valeurs).donnee; (*l_emplacement_valeurs).donnee = NULL; @@ -762,8 +766,8 @@ instruction_fleche_list(struct_processus struct_objet *s_objet; - signed long i; - signed long nombre_elements; + integer8 i; + integer8 nombre_elements; (*s_etat_processus).erreur_execution = d_ex;