--- rpl/src/instructions_d5.c 2010/06/08 10:22:37 1.26 +++ rpl/src/instructions_d5.c 2010/08/26 17:49:34 1.39 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.0.16 + RPL/2 (R) version 4.0.18 Copyright (C) 1989-2010 Dr. BERTRAND Joël This file is part of RPL/2. @@ -20,7 +20,7 @@ */ -#include "rpl.conv.h" +#include "rpl-conv.h" /* @@ -1200,12 +1200,6 @@ instruction_detach(struct_processus *s_e (*(*((struct_processus_fils *) (*s_objet).objet)).thread) .nombre_references = 1; - if (pthread_mutex_unlock(&((*s_etat_processus).mutex)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - /* * On copie l'objet plutôt que le pointeur car cet objet peut être * accédé depuis deux threads distincts et aboutir à un blocage lors @@ -1281,6 +1275,7 @@ instruction_detach(struct_processus *s_e return; } +# ifndef OS2 if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; @@ -1299,6 +1294,7 @@ instruction_detach(struct_processus *s_e (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif (*s_argument_thread).s_etat_processus = s_etat_processus; @@ -1321,6 +1317,11 @@ instruction_detach(struct_processus *s_e * Processus fils */ +# ifdef _BROKEN_SIGINFO + liberation_fifos_signaux(s_etat_processus); + creation_fifos_signaux(s_etat_processus); +# endif + if ((*s_etat_processus).debug == d_vrai) if (((*s_etat_processus).type_debug & d_debug_processus) != 0) @@ -1510,6 +1511,10 @@ instruction_detach(struct_processus *s_e } } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + BUG(1, uprintf("Process management error line %d\n", __LINE__)); exit(EXIT_FAILURE); } @@ -1540,10 +1545,16 @@ instruction_detach(struct_processus *s_e } } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + BUG(1, uprintf("Process management error line %d\n", __LINE__)); exit(EXIT_FAILURE); } + pthread_mutex_trylock(&((*s_etat_processus).protection_liste_mutexes)); + if (pthread_mutex_unlock(&((*s_etat_processus) .protection_liste_mutexes)) != 0) { @@ -1571,6 +1582,10 @@ instruction_detach(struct_processus *s_e } } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + BUG(1, uprintf("Process management error line %d\n", __LINE__)); exit(EXIT_FAILURE); } @@ -1593,6 +1608,9 @@ instruction_detach(struct_processus *s_e liberation(s_etat_processus, (*s_etat_processus).at_exit); (*s_etat_processus).at_exit = NULL; + liberation(s_etat_processus, (*s_etat_processus).at_poke); + (*s_etat_processus).at_poke = NULL; + (*s_etat_processus).traitement_at_poke = 'N'; for(i = 0; i < d_NOMBRE_INTERRUPTIONS; i++) { @@ -1716,6 +1734,10 @@ instruction_detach(struct_processus *s_e } } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + BUG(1, uprintf("Process management error line %d\n", __LINE__)); exit(EXIT_FAILURE); } @@ -1732,6 +1754,9 @@ instruction_detach(struct_processus *s_e (*s_argument_thread2).nombre_references--; BUG((*s_argument_thread2).nombre_references < 0, +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus), +# endif printf("(*s_argument_thread2).nombre_references = %d\n", (int) (*s_argument_thread2).nombre_references)); @@ -1758,6 +1783,8 @@ instruction_detach(struct_processus *s_e } free(s_argument_thread2); + free((*(*l_element_courant).donnee).objet); + free((*l_element_courant).donnee); } l_element_suivant = (*l_element_courant).suivant; @@ -1793,6 +1820,10 @@ instruction_detach(struct_processus *s_e } } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + BUG(1, uprintf("Process management error line %d\n", __LINE__)); exit(EXIT_FAILURE); } @@ -1857,6 +1888,10 @@ instruction_detach(struct_processus *s_e } } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + BUG(1, uprintf("Process management error line %d\n", __LINE__)); exit(EXIT_FAILURE); } @@ -1909,6 +1944,10 @@ instruction_detach(struct_processus *s_e } } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + BUG(1, uprintf("Process management error line %d\n", __LINE__)); exit(EXIT_FAILURE); } @@ -2093,6 +2132,7 @@ instruction_detach(struct_processus *s_e } liberation(s_etat_processus, (*s_etat_processus).at_exit); + liberation(s_etat_processus, (*s_etat_processus).at_poke); l_element_courant = (*s_etat_processus).liste_mutexes; while(l_element_courant != NULL) @@ -2456,6 +2496,10 @@ instruction_detach(struct_processus *s_e registre_stop; } +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + (*s_etat_processus).erreur_systeme = d_es_signal; exit(EXIT_FAILURE); } @@ -2490,6 +2534,10 @@ instruction_detach(struct_processus *s_e if (sigaction(SIGPIPE, ®istre, NULL) != 0) { +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + pthread_mutex_unlock(&((*s_etat_processus).mutex)); (*s_etat_processus).erreur_systeme = d_es_signal; @@ -2806,7 +2854,7 @@ instruction_detach(struct_processus *s_e liberation(s_etat_processus, s_objet); -# ifndef Cygwin +# if !defined(Cygwin) && !defined(OpenBSD) (*s_etat_processus).pile_signal.ss_flags = SS_DISABLE; sigaltstack(&((*s_etat_processus).pile_signal), NULL); free((*s_etat_processus).pile_signal.ss_sp); @@ -2851,6 +2899,7 @@ instruction_detach(struct_processus *s_e retrait_thread(s_etat_processus); pthread_mutex_destroy(&((*s_etat_processus).mutex)); + pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); pthread_key_delete(semaphore_fork_processus_courant); @@ -2882,6 +2931,10 @@ instruction_detach(struct_processus *s_e clear_history(); +# ifdef _BROKEN_SIGINFO + destruction_fifos_signaux(s_etat_processus); +# endif + free(s_etat_processus); # ifdef DEBUG_MEMOIRE @@ -2895,12 +2948,6 @@ instruction_detach(struct_processus *s_e { (*s_etat_processus).erreur_systeme = d_es_processus; return; - } - - if (pthread_mutex_lock(&((*s_etat_processus).mutex)) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; } // Si le pid existe déjà dans la pile des processus, il s'agit forcement