version 1.35, 2010/08/13 21:00:37
|
version 1.60, 2011/07/25 07:44:56
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.0.18 |
RPL/2 (R) version 4.1.2 |
Copyright (C) 1989-2010 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 890 instruction_detach(struct_processus *s_e
|
Line 890 instruction_detach(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
# ifdef _BROKEN_SIGINFO |
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf("+++Attention : Support des processus multiples indisponible\n"); |
|
} |
|
else |
|
{ |
|
printf("+++Attention : Multiprocess unavailable\n"); |
|
} |
|
|
|
return; |
|
# endif |
|
|
|
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
if (test_cfsf(s_etat_processus, 31) == d_vrai) |
{ |
{ |
if (empilement_pile_last(s_etat_processus, 1) == d_erreur) |
if (empilement_pile_last(s_etat_processus, 1) == d_erreur) |
Line 944 instruction_detach(struct_processus *s_e
|
Line 931 instruction_detach(struct_processus *s_e
|
if (recherche_variable(s_etat_processus, (*((struct_nom *) |
if (recherche_variable(s_etat_processus, (*((struct_nom *) |
(*s_objet).objet)).nom) == d_vrai) |
(*s_objet).objet)).nom) == d_vrai) |
{ |
{ |
if ((*s_etat_processus).s_liste_variables |
if ((*(*s_etat_processus).pointeur_variable_courante).objet |
[(*s_etat_processus).position_variable_courante].objet |
|
== NULL) |
== NULL) |
{ |
{ |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
if (pthread_mutex_lock(&((*(*s_etat_processus) |
Line 956 instruction_detach(struct_processus *s_e
|
Line 942 instruction_detach(struct_processus *s_e
|
} |
} |
|
|
if (recherche_variable_partagee(s_etat_processus, |
if (recherche_variable_partagee(s_etat_processus, |
(*s_etat_processus).s_liste_variables |
(*(*s_etat_processus).pointeur_variable_courante).nom, |
[(*s_etat_processus).position_variable_courante].nom, |
(*(*s_etat_processus).pointeur_variable_courante) |
(*s_etat_processus).s_liste_variables |
.variable_partagee, (*(*s_etat_processus) |
[(*s_etat_processus).position_variable_courante] |
.pointeur_variable_courante).origine) == d_faux) |
.variable_partagee, (*s_etat_processus) |
|
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].origine) == d_faux) |
|
{ |
{ |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
if (pthread_mutex_unlock(&((*(*s_etat_processus) |
.s_liste_variables_partagees).mutex)) != 0) |
.s_liste_variables_partagees).mutex)) != 0) |
Line 1030 instruction_detach(struct_processus *s_e
|
Line 1013 instruction_detach(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
if (((*(*s_etat_processus).s_liste_variables |
if (((*(*(*s_etat_processus).pointeur_variable_courante).objet) |
[(*s_etat_processus).position_variable_courante].objet) |
.type != RPN) && ((*(*(*s_etat_processus) |
.type != RPN) && ((*(*s_etat_processus) |
.pointeur_variable_courante).objet).type != ADR)) |
.s_liste_variables[(*s_etat_processus) |
|
.position_variable_courante].objet).type != ADR)) |
|
{ |
{ |
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
Line 1172 instruction_detach(struct_processus *s_e
|
Line 1153 instruction_detach(struct_processus *s_e
|
|
|
verrouillage_threads_concurrents(s_etat_processus); |
verrouillage_threads_concurrents(s_etat_processus); |
(*s_argument_thread).pid = fork(); |
(*s_argument_thread).pid = fork(); |
|
|
# ifdef OS2 |
|
if ((*s_argument_thread).pid == 0) |
|
{ |
|
sem_init(&semaphore_liste_threads, 0, 1); |
|
sem_init(&semaphore_gestionnaires_signaux, 0, 0); |
|
sem_init(&semaphore_gestionnaires_signaux_atomique, 0, 1); |
|
sem_init(&((*s_etat_processus).semaphore_fork), 0, 0); |
|
} |
|
# endif |
|
|
|
deverrouillage_threads_concurrents(s_etat_processus); |
deverrouillage_threads_concurrents(s_etat_processus); |
|
|
pthread_sigmask(SIG_SETMASK, &oldset2, NULL); |
pthread_sigmask(SIG_SETMASK, &oldset2, NULL); |
Line 1196 instruction_detach(struct_processus *s_e
|
Line 1166 instruction_detach(struct_processus *s_e
|
pthread_mutex_init(&((*s_argument_thread).mutex), &attributs_mutex); |
pthread_mutex_init(&((*s_argument_thread).mutex), &attributs_mutex); |
pthread_mutexattr_destroy(&attributs_mutex); |
pthread_mutexattr_destroy(&attributs_mutex); |
|
|
|
pthread_mutexattr_init(&attributs_mutex); |
|
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); |
|
pthread_mutex_init(&((*s_argument_thread).mutex_nombre_references), |
|
&attributs_mutex); |
|
pthread_mutexattr_destroy(&attributs_mutex); |
|
|
if ((*s_argument_thread).pid > 0) |
if ((*s_argument_thread).pid > 0) |
{ |
{ |
/* |
/* |
Line 1300 instruction_detach(struct_processus *s_e
|
Line 1276 instruction_detach(struct_processus *s_e
|
} |
} |
|
|
# ifndef OS2 |
# ifndef OS2 |
|
# 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; |
Line 1319 instruction_detach(struct_processus *s_e
|
Line 1296 instruction_detach(struct_processus *s_e
|
return; |
return; |
} |
} |
# endif |
# endif |
|
# endif |
|
|
(*s_argument_thread).s_etat_processus = s_etat_processus; |
(*s_argument_thread).s_etat_processus = s_etat_processus; |
|
|
Line 1341 instruction_detach(struct_processus *s_e
|
Line 1319 instruction_detach(struct_processus *s_e
|
* Processus fils |
* 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).debug == d_vrai) |
if (((*s_etat_processus).type_debug & |
if (((*s_etat_processus).type_debug & |
d_debug_processus) != 0) |
d_debug_processus) != 0) |
Line 1530 instruction_detach(struct_processus *s_e
|
Line 1513 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__)); |
BUG(1, uprintf("Process management error line %d\n", __LINE__)); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 1560 instruction_detach(struct_processus *s_e
|
Line 1547 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__)); |
BUG(1, uprintf("Process management error line %d\n", __LINE__)); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 1593 instruction_detach(struct_processus *s_e
|
Line 1584 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__)); |
BUG(1, uprintf("Process management error line %d\n", __LINE__)); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 1604 instruction_detach(struct_processus *s_e
|
Line 1599 instruction_detach(struct_processus *s_e
|
} |
} |
|
|
(*s_etat_processus).var_volatile_processus_pere = 0; |
(*s_etat_processus).var_volatile_processus_pere = 0; |
|
(*s_etat_processus).var_volatile_processus_racine = 0; |
|
|
// On réinitialise toutes les interruptions. |
// On réinitialise toutes les interruptions. |
|
|
Line 1741 instruction_detach(struct_processus *s_e
|
Line 1737 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__)); |
BUG(1, uprintf("Process management error line %d\n", __LINE__)); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 1757 instruction_detach(struct_processus *s_e
|
Line 1757 instruction_detach(struct_processus *s_e
|
(*s_argument_thread2).nombre_references--; |
(*s_argument_thread2).nombre_references--; |
|
|
BUG((*s_argument_thread2).nombre_references < 0, |
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", |
printf("(*s_argument_thread2).nombre_references = %d\n", |
(int) (*s_argument_thread2).nombre_references)); |
(int) (*s_argument_thread2).nombre_references)); |
|
|
Line 1820 instruction_detach(struct_processus *s_e
|
Line 1823 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__)); |
BUG(1, uprintf("Process management error line %d\n", __LINE__)); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 1884 instruction_detach(struct_processus *s_e
|
Line 1891 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__)); |
BUG(1, uprintf("Process management error line %d\n", __LINE__)); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 1936 instruction_detach(struct_processus *s_e
|
Line 1947 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__)); |
BUG(1, uprintf("Process management error line %d\n", __LINE__)); |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 2484 instruction_detach(struct_processus *s_e
|
Line 2499 instruction_detach(struct_processus *s_e
|
registre_stop; |
registre_stop; |
} |
} |
|
|
|
# ifdef _BROKEN_SIGINFO |
|
destruction_fifos_signaux(s_etat_processus); |
|
# endif |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
} |
} |
Line 2518 instruction_detach(struct_processus *s_e
|
Line 2537 instruction_detach(struct_processus *s_e
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
|
# ifdef _BROKEN_SIGINFO |
|
destruction_fifos_signaux(s_etat_processus); |
|
# endif |
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
Line 2659 instruction_detach(struct_processus *s_e
|
Line 2682 instruction_detach(struct_processus *s_e
|
(*s_etat_processus).instruction_derniere_erreur = NULL; |
(*s_etat_processus).instruction_derniere_erreur = NULL; |
} |
} |
|
|
for(i = 0; i < (*s_etat_processus).nombre_variables; i++) |
liberation_arbre_variables(s_etat_processus, |
{ |
(*s_etat_processus).s_arbre_variables, d_vrai); |
liberation(s_etat_processus, |
free((*s_etat_processus).pointeurs_caracteres_variables); |
(*s_etat_processus).s_liste_variables[i].objet); |
|
free((*s_etat_processus).s_liste_variables[i].nom); |
|
} |
|
|
|
free((*s_etat_processus).s_liste_variables); |
|
|
|
for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++) |
for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++) |
{ |
{ |
Line 2834 instruction_detach(struct_processus *s_e
|
Line 2852 instruction_detach(struct_processus *s_e
|
|
|
liberation(s_etat_processus, s_objet); |
liberation(s_etat_processus, s_objet); |
|
|
# if !defined(Cygwin) |
|
(*s_etat_processus).pile_signal.ss_flags = SS_DISABLE; |
|
sigaltstack(&((*s_etat_processus).pile_signal), NULL); |
|
free((*s_etat_processus).pile_signal.ss_sp); |
|
# endif |
|
|
|
free((*s_etat_processus).definitions_chainees); |
free((*s_etat_processus).definitions_chainees); |
free((*s_etat_processus).nom_fichier_historique); |
free((*s_etat_processus).nom_fichier_historique); |
|
|
Line 2911 instruction_detach(struct_processus *s_e
|
Line 2923 instruction_detach(struct_processus *s_e
|
|
|
clear_history(); |
clear_history(); |
|
|
|
# ifdef _BROKEN_SIGINFO |
|
destruction_fifos_signaux(s_etat_processus); |
|
# endif |
|
|
free(s_etat_processus); |
free(s_etat_processus); |
|
|
# ifdef DEBUG_MEMOIRE |
# ifdef DEBUG_MEMOIRE |
Line 2990 instruction_detach(struct_processus *s_e
|
Line 3006 instruction_detach(struct_processus *s_e
|
|
|
// Être sûr que le processus fils soit déjà présent... |
// Être sûr que le processus fils soit déjà présent... |
|
|
|
attente.tv_sec = 0; |
|
attente.tv_nsec = GRANULARITE_us * 1000; |
|
|
while(kill((*s_argument_thread).pid, 0) != 0) |
while(kill((*s_argument_thread).pid, 0) != 0) |
{ |
{ |
//if ((errno != ESRCH) && (errno != EAGAIN)) |
//if ((errno != ESRCH) && (errno != EAGAIN)) |
Line 3001 instruction_detach(struct_processus *s_e
|
Line 3020 instruction_detach(struct_processus *s_e
|
} |
} |
|
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
|
INCR_GRANULARITE(attente.tv_nsec); |
} |
} |
|
|
// Le fils peut être présent sans être en attente du signal de départ. |
// Le fils peut être présent sans être en attente du signal de départ. |