version 1.71, 2011/09/20 08:56:23
|
version 1.80, 2011/11/18 21:20:02
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.3 |
RPL/2 (R) version 4.1.4 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2011 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 1277 instruction_detach(struct_processus *s_e
|
Line 1280 instruction_detach(struct_processus *s_e
|
|
|
liberation_queue_signaux(s_etat_processus); |
liberation_queue_signaux(s_etat_processus); |
creation_queue_signaux(s_etat_processus); |
creation_queue_signaux(s_etat_processus); |
|
routine_recursive = 0; |
|
|
(*s_etat_processus).pointeur_signal_lecture = 0; |
(*s_etat_processus).pointeur_signal_lecture = 0; |
(*s_etat_processus).pointeur_signal_ecriture = 0; |
(*s_etat_processus).pointeur_signal_ecriture = 0; |
Line 1951 instruction_detach(struct_processus *s_e
|
Line 1955 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 1984 instruction_detach(struct_processus *s_e
|
Line 2000 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 1995 instruction_detach(struct_processus *s_e
|
Line 2011 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 2009 instruction_detach(struct_processus *s_e
|
Line 2027 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 2768 instruction_detach(struct_processus *s_e
|
Line 2788 instruction_detach(struct_processus *s_e
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
sem_post(&((*s_etat_processus).semaphore_fork)); |
sem_post(&((*s_etat_processus).semaphore_fork)); |
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus).semaphore_fork); |
|
sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
free((*s_etat_processus).localisation); |
free((*s_etat_processus).localisation); |
free(s_argument_thread); |
free(s_argument_thread); |