--- rpl/src/instructions_d5.c 2015/07/21 20:16:19 1.132 +++ rpl/src/instructions_d5.c 2016/03/09 10:57:41 1.139 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.22 - Copyright (C) 1989-2015 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.25 + Copyright (C) 1989-2016 Dr. BERTRAND Joël This file is part of RPL/2. @@ -1088,13 +1088,13 @@ instruction_detach(struct_processus *s_e return; } - if (pthread_mutex_lock(&((*s_etat_processus).mutex_allocation_buffer)) != 0) + if (pthread_mutex_lock(&mutex_liste_variables_partagees) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } - if (pthread_mutex_lock(&mutex_liste_variables_partagees) != 0) + if (pthread_mutex_lock(&((*s_etat_processus).mutex_allocation_buffer)) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -1109,7 +1109,11 @@ instruction_detach(struct_processus *s_e verrouillage_threads_concurrents(s_etat_processus); (*s_argument_thread).pid = fork(); - deverrouillage_threads_concurrents(s_etat_processus); + + if ((*s_argument_thread).pid > 0) + { + deverrouillage_threads_concurrents(s_etat_processus); + } if (pthread_mutex_unlock(&((*s_etat_processus).mutex_allocation_buffer)) != 0) @@ -1288,6 +1292,13 @@ instruction_detach(struct_processus *s_e pthread_mutex_init(&mutex_liste_variables_partagees, &attributs_mutex); pthread_mutexattr_destroy(&attributs_mutex); + pthread_mutex_destroy(&mutex_liste_threads); + + pthread_mutexattr_init(&attributs_mutex); + pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mutex_liste_threads, &attributs_mutex); + pthread_mutexattr_destroy(&attributs_mutex); + liberation_queue_signaux(s_etat_processus); creation_queue_signaux(s_etat_processus);