--- rpl/src/instructions_d5.c 2011/09/21 09:09:22 1.74 +++ rpl/src/instructions_d5.c 2011/11/26 10:01:28 1.83 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.1.3 + RPL/2 (R) version 4.1.5 Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -817,7 +817,6 @@ instruction_detach(struct_processus *s_e int pipe_initialisation_segment_signaux[2]; logical1 drapeau; - logical1 variable_partagee; pid_t ppid; pid_t pid_final; @@ -856,6 +855,8 @@ instruction_detach(struct_processus *s_e unsigned long i; + volatile logical1 variable_partagee; + (*s_etat_processus).erreur_execution = d_ex; attente.tv_sec = 0; @@ -1231,28 +1232,30 @@ instruction_detach(struct_processus *s_e return; } -# ifndef OS2 -# ifndef Cygwin +# ifdef SCHED_OTHER if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_EXPLICIT_SCHED if (pthread_attr_setinheritsched(&attributs, PTHREAD_EXPLICIT_SCHED) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_SCOPE_SYSTEM if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } # endif -# endif (*s_argument_thread).s_etat_processus = s_etat_processus; @@ -1952,6 +1955,18 @@ instruction_detach(struct_processus *s_e if ((*s_etat_processus).erreur_systeme == d_es) { + // Évite le warning variable s_copie might be clobbered by + // longjmp or vfork + struct_objet **s; + + if ((s = malloc(sizeof(struct_objet *))) == NULL) + { + (*s_etat_processus).erreur_execution = d_es_allocation_memoire; + return; + } + + (*s) = s_copie; + if (setjmp(contexte_processus) == 0) { if (variable_partagee == d_faux) @@ -1985,7 +2000,7 @@ instruction_detach(struct_processus *s_e } else { - if (evaluation(s_etat_processus, s_copie, 'E') == d_erreur) + if (evaluation(s_etat_processus, (*s), 'E') == d_erreur) { if (((*s_etat_processus).erreur_execution == d_ex) && ((*s_etat_processus).erreur_systeme == d_es)) @@ -1996,7 +2011,9 @@ instruction_detach(struct_processus *s_e } else { - if ((*s_etat_processus).at_exit != NULL) + if (((*s_etat_processus).var_volatile_alarme == 0) + && ((*s_etat_processus).arret_depuis_abort == 0) + && ((*s_etat_processus).at_exit != NULL)) { (*s_etat_processus).var_volatile_requete_arret = 0; @@ -2010,9 +2027,11 @@ instruction_detach(struct_processus *s_e } } - liberation(s_etat_processus, s_copie); + liberation(s_etat_processus, (*s)); } } + + free(s); } liberation(s_etat_processus, (*s_etat_processus).at_exit);