--- rpl/src/instructions_d5.c 2015/01/30 07:53:15 1.124 +++ rpl/src/instructions_d5.c 2015/02/01 09:47:18 1.125 @@ -1088,6 +1088,12 @@ instruction_detach(struct_processus *s_e return; } + if (pthread_mutex_lock(&((*s_etat_processus).mutex_allocation_buffer)) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + fflush(NULL); /* @@ -1099,6 +1105,13 @@ instruction_detach(struct_processus *s_e (*s_argument_thread).pid = fork(); deverrouillage_threads_concurrents(s_etat_processus); + if (pthread_mutex_unlock(&((*s_etat_processus).mutex_allocation_buffer)) + != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + (*s_argument_thread).thread_pere = pthread_self(); (*s_argument_thread).processus_detache = d_vrai; @@ -2780,7 +2793,6 @@ instruction_detach(struct_processus *s_e pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus)); pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); - pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation_buffer)); pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions)); pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux)); pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); @@ -2804,6 +2816,7 @@ instruction_detach(struct_processus *s_e liberation_contexte_cas(s_etat_processus); arret_thread_signaux(s_etat_processus); liberation_allocateur_buffer(s_etat_processus); + pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation_buffer)); sys_free(s_etat_processus); # ifdef DEBUG_MEMOIRE