version 1.54, 2011/09/20 15:45:53
|
version 1.70, 2012/12/18 13:19:35
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.3 |
RPL/2 (R) version 4.1.12 |
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 38
|
Line 38
|
void * |
void * |
lancement_thread(void *argument) |
lancement_thread(void *argument) |
{ |
{ |
int status; |
int status; |
|
|
pid_t ppid; |
pid_t ppid; |
|
|
pthread_t tid_final; |
pthread_t tid_final; |
|
|
sig_atomic_t registre_stop; |
sig_atomic_t registre_stop; |
|
|
ssize_t longueur_ecriture; |
ssize_t longueur_ecriture; |
|
|
struct_descripteur_thread *s_argument_thread; |
struct_descripteur_thread *s_argument_thread; |
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_courant; |
struct_liste_chainee *l_element_suivant; |
struct_liste_chainee *l_element_suivant; |
|
|
struct_objet *s_objet_temporaire; |
struct_liste_variables_statiques *l_element_statique_courant; |
|
struct_liste_variables_statiques *l_element_statique_suivant; |
|
|
struct_processus *s_etat_processus; |
struct_objet *s_objet_temporaire; |
|
|
struct sigaction action; |
struct_processus *s_etat_processus; |
struct sigaction registre; |
|
|
|
struct timespec attente; |
struct sigaction action; |
|
struct sigaction registre; |
|
|
unsigned char *message; |
struct timespec attente; |
|
|
unsigned int erreur; |
unsigned char *message; |
|
|
unsigned long i; |
unsigned int erreur; |
|
|
|
unsigned long i; |
|
|
attente.tv_sec = 0; |
attente.tv_sec = 0; |
attente.tv_nsec = GRANULARITE_us * 1000; |
attente.tv_nsec = GRANULARITE_us * 1000; |
|
|
s_argument_thread = (struct_descripteur_thread *) argument; |
s_argument_thread = (struct_descripteur_thread *) argument; |
s_etat_processus = (*s_argument_thread).s_nouvel_etat_processus; |
s_etat_processus = (*s_argument_thread).s_nouvel_etat_processus; |
|
|
|
# ifndef SEMAPHORES_NOMMES |
|
sem_init(&((*s_etat_processus).semaphore_fork), 0, 0); |
|
# else |
|
if (((*s_etat_processus).semaphore_fork = sem_init3(0, getpid(), |
|
pthread_self(), SEM_FORK)) == SEM_FAILED) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return(NULL); |
|
} |
|
# endif |
|
|
(*s_argument_thread).tid = pthread_self(); |
(*s_argument_thread).tid = pthread_self(); |
(*s_argument_thread).thread_actif = d_vrai; |
(*s_argument_thread).thread_actif = d_vrai; |
|
|
Line 92 lancement_thread(void *argument)
|
Line 107 lancement_thread(void *argument)
|
|
|
(*s_argument_thread).thread_actif = d_faux; |
(*s_argument_thread).thread_actif = d_faux; |
|
|
tid_final = -2; |
tid_final = (pthread_t) -2; |
|
|
while((longueur_ecriture = write_atomic(s_etat_processus, |
while((longueur_ecriture = write_atomic(s_etat_processus, |
(*s_argument_thread).pipe_nombre_interruptions_attente[1], |
(*s_argument_thread).pipe_nombre_interruptions_attente[1], |
Line 207 lancement_thread(void *argument)
|
Line 222 lancement_thread(void *argument)
|
pthread_cancel((*s_etat_processus).thread_fusible); |
pthread_cancel((*s_etat_processus).thread_fusible); |
} |
} |
|
|
tid_final = -2; |
tid_final = (pthread_t) -2; |
|
|
while((longueur_ecriture = write_atomic(s_etat_processus, |
while((longueur_ecriture = write_atomic(s_etat_processus, |
(*s_argument_thread).pipe_nombre_interruptions_attente[1], |
(*s_argument_thread).pipe_nombre_interruptions_attente[1], |
Line 801 lancement_thread(void *argument)
|
Line 816 lancement_thread(void *argument)
|
liberation_arbre_variables(s_etat_processus, |
liberation_arbre_variables(s_etat_processus, |
(*s_etat_processus).s_arbre_variables, d_faux); |
(*s_etat_processus).s_arbre_variables, d_faux); |
|
|
for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++) |
l_element_statique_courant = (*s_etat_processus) |
|
.l_liste_variables_statiques; |
|
|
|
while(l_element_statique_courant != NULL) |
{ |
{ |
liberation(s_etat_processus, |
l_element_statique_suivant = (*l_element_statique_courant).suivant; |
(*s_etat_processus).s_liste_variables_statiques[i].objet); |
free(l_element_statique_courant); |
free((*s_etat_processus).s_liste_variables_statiques[i].nom); |
l_element_statique_courant = l_element_statique_suivant; |
} |
} |
|
|
free((*s_etat_processus).s_liste_variables_statiques); |
|
|
|
l_element_courant = (*s_etat_processus).l_base_pile; |
l_element_courant = (*s_etat_processus).l_base_pile; |
while(l_element_courant != NULL) |
while(l_element_courant != NULL) |
{ |
{ |
Line 987 lancement_thread(void *argument)
|
Line 1003 lancement_thread(void *argument)
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
# else |
# else |
sem_destroy2((*s_etat_processus).semaphore_fork, getpid(), SEM_FORK); |
sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
# endif |
# endif |
|
|
liberation_contexte_cas(s_etat_processus); |
liberation_contexte_cas(s_etat_processus); |