version 1.75, 2011/09/26 15:57:12
|
version 1.89, 2012/05/21 17:25:43
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.4 |
RPL/2 (R) version 4.1.9 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 817 instruction_detach(struct_processus *s_e
|
Line 817 instruction_detach(struct_processus *s_e
|
int pipe_initialisation_segment_signaux[2]; |
int pipe_initialisation_segment_signaux[2]; |
|
|
logical1 drapeau; |
logical1 drapeau; |
logical1 variable_partagee; |
|
|
|
pid_t ppid; |
pid_t ppid; |
pid_t pid_final; |
pid_t pid_final; |
Line 856 instruction_detach(struct_processus *s_e
|
Line 855 instruction_detach(struct_processus *s_e
|
|
|
unsigned long i; |
unsigned long i; |
|
|
|
volatile logical1 variable_partagee; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
attente.tv_sec = 0; |
attente.tv_sec = 0; |
Line 1231 instruction_detach(struct_processus *s_e
|
Line 1232 instruction_detach(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
# ifndef OS2 |
# ifdef SCHED_OTHER |
# ifndef Cygwin |
|
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_EXPLICIT_SCHED |
if (pthread_attr_setinheritsched(&attributs, |
if (pthread_attr_setinheritsched(&attributs, |
PTHREAD_EXPLICIT_SCHED) != 0) |
PTHREAD_EXPLICIT_SCHED) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_SCOPE_SYSTEM |
if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) |
if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
# endif |
# endif |
# endif |
|
|
|
(*s_argument_thread).s_etat_processus = s_etat_processus; |
(*s_argument_thread).s_etat_processus = s_etat_processus; |
|
|
Line 1364 instruction_detach(struct_processus *s_e
|
Line 1367 instruction_detach(struct_processus *s_e
|
l_element_courant = (*s_etat_processus).liste_mutexes; |
l_element_courant = (*s_etat_processus).liste_mutexes; |
while(l_element_courant != NULL) |
while(l_element_courant != NULL) |
{ |
{ |
pthread_mutex_trylock(&((*((struct_mutex *) (*(*l_element_courant) |
|
.donnee).objet)).mutex)); |
|
pthread_mutex_unlock(&((*((struct_mutex *) (*(*l_element_courant) |
|
.donnee).objet)).mutex)); |
|
pthread_mutex_destroy(&((*((struct_mutex *) (*(*l_element_courant) |
|
.donnee).objet)).mutex)); |
|
|
|
liberation(s_etat_processus, (*l_element_courant).donnee); |
liberation(s_etat_processus, (*l_element_courant).donnee); |
l_element_suivant = (*l_element_courant).suivant; |
l_element_suivant = (*l_element_courant).suivant; |
free(l_element_courant); |
free(l_element_courant); |
Line 1952 instruction_detach(struct_processus *s_e
|
Line 1948 instruction_detach(struct_processus *s_e
|
|
|
if ((*s_etat_processus).erreur_systeme == d_es) |
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 (setjmp(contexte_processus) == 0) |
{ |
{ |
if (variable_partagee == d_faux) |
if (variable_partagee == d_faux) |
Line 1985 instruction_detach(struct_processus *s_e
|
Line 1993 instruction_detach(struct_processus *s_e
|
} |
} |
else |
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) && |
if (((*s_etat_processus).erreur_execution == d_ex) && |
((*s_etat_processus).erreur_systeme == d_es)) |
((*s_etat_processus).erreur_systeme == d_es)) |
Line 1996 instruction_detach(struct_processus *s_e
|
Line 2004 instruction_detach(struct_processus *s_e
|
} |
} |
else |
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; |
(*s_etat_processus).var_volatile_requete_arret = 0; |
|
|
Line 2010 instruction_detach(struct_processus *s_e
|
Line 2020 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); |
liberation(s_etat_processus, (*s_etat_processus).at_exit); |
Line 2021 instruction_detach(struct_processus *s_e
|
Line 2033 instruction_detach(struct_processus *s_e
|
l_element_courant = (*s_etat_processus).liste_mutexes; |
l_element_courant = (*s_etat_processus).liste_mutexes; |
while(l_element_courant != NULL) |
while(l_element_courant != NULL) |
{ |
{ |
pthread_mutex_trylock(&((*((struct_mutex *) |
|
(*(*l_element_courant).donnee).objet)).mutex)); |
|
pthread_mutex_unlock(&((*((struct_mutex *) |
|
(*(*l_element_courant).donnee).objet)).mutex)); |
|
pthread_mutex_destroy(&((*((struct_mutex *) |
|
(*(*l_element_courant).donnee).objet)).mutex)); |
|
|
|
liberation(s_etat_processus, (*l_element_courant).donnee); |
liberation(s_etat_processus, (*l_element_courant).donnee); |
l_element_suivant = (*l_element_courant).suivant; |
l_element_suivant = (*l_element_courant).suivant; |
free(l_element_courant); |
free(l_element_courant); |