version 1.54, 2011/09/20 15:45:53
|
version 1.113, 2019/02/11 09:45:48
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.3 |
RPL/2 (R) version 4.1.31 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2019 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; |
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_suivant; |
|
|
struct_liste_chainee *l_element_courant; |
struct_liste_variables_statiques *l_element_statique_courant; |
struct_liste_chainee *l_element_suivant; |
struct_liste_variables_statiques *l_element_statique_suivant; |
|
|
struct_objet *s_objet_temporaire; |
struct_objet *s_objet_temporaire; |
|
|
struct_processus *s_etat_processus; |
struct_processus *s_etat_processus; |
|
|
struct sigaction action; |
struct sigaction action; |
struct sigaction registre; |
struct sigaction registre; |
|
|
struct timespec attente; |
struct timespec attente; |
|
|
unsigned char *message; |
unsigned char caractere; |
|
unsigned char *message; |
|
|
unsigned int erreur; |
unsigned int erreur; |
|
|
unsigned long i; |
integer8 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; |
|
pthread_exit(NULL); |
|
} |
|
# endif |
|
|
(*s_argument_thread).tid = pthread_self(); |
(*s_argument_thread).tid = pthread_self(); |
|
insertion_thread(s_etat_processus, d_faux); |
|
|
|
if (pthread_mutex_lock(&((*s_argument_thread).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_exit(NULL); |
|
} |
|
|
(*s_argument_thread).thread_actif = d_vrai; |
(*s_argument_thread).thread_actif = d_vrai; |
|
|
insertion_thread(s_etat_processus, d_faux); |
if (pthread_mutex_unlock(&((*s_argument_thread).mutex)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_exit(NULL); |
|
} |
|
|
// Envoi d'une donnée pour signaler le démarrage du thread au thread |
// Envoi d'une donnée pour signaler le démarrage du thread au thread |
// de surveillance. |
// de surveillance. |
|
|
|
caractere = 0; |
|
|
if (write_atomic(s_etat_processus, |
if (write_atomic(s_etat_processus, |
(*s_argument_thread).pipe_nombre_objets_attente[1], |
(*s_argument_thread).pipe_nombre_elements_attente[1], |
"-", sizeof(unsigned char)) != sizeof(unsigned char)) |
&caractere, sizeof(caractere)) != sizeof(caractere)) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
|
Line 92 lancement_thread(void *argument)
|
Line 120 lancement_thread(void *argument)
|
|
|
(*s_argument_thread).thread_actif = d_faux; |
(*s_argument_thread).thread_actif = d_faux; |
|
|
tid_final = -2; |
|
|
|
while((longueur_ecriture = write_atomic(s_etat_processus, |
|
(*s_argument_thread).pipe_nombre_interruptions_attente[1], |
|
&tid_final, sizeof(tid_final))) != sizeof(tid_final)) |
|
{ |
|
if (longueur_ecriture == -1) |
|
{ |
|
break; |
|
} |
|
} |
|
|
|
while((longueur_ecriture = write_atomic(s_etat_processus, |
while((longueur_ecriture = write_atomic(s_etat_processus, |
(*s_argument_thread).pipe_nombre_objets_attente[1], |
(*s_argument_thread).pipe_nombre_elements_attente[1], |
&tid_final, sizeof(tid_final))) != sizeof(tid_final)) |
&caractere, sizeof(caractere))) != sizeof(caractere)) |
{ |
{ |
if (longueur_ecriture == -1) |
if (longueur_ecriture == -1) |
{ |
{ |
Line 134 lancement_thread(void *argument)
|
Line 150 lancement_thread(void *argument)
|
break; |
break; |
} |
} |
|
|
|
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_exit(NULL); |
|
} |
|
|
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
|
|
|
while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_exit(NULL); |
|
} |
|
} |
} |
} |
|
|
if ((*s_etat_processus).debug == d_vrai) |
if ((*s_etat_processus).debug == d_vrai) |
Line 174 lancement_thread(void *argument)
|
Line 205 lancement_thread(void *argument)
|
} |
} |
else |
else |
{ |
{ |
if (((*s_etat_processus).var_volatile_alarme == 0) |
if (((*s_etat_processus).arret_depuis_abort == 0) |
&& ((*s_etat_processus).arret_depuis_abort == 0) |
|
&& ((*s_etat_processus).at_exit != NULL)) |
&& ((*s_etat_processus).at_exit != NULL)) |
{ |
{ |
(*s_etat_processus).var_volatile_requete_arret = 0; |
(*s_etat_processus).var_volatile_requete_arret = 0; |
(*s_etat_processus).var_volatile_traitement_retarde_stop = |
(*s_etat_processus).var_volatile_alarme = 0; |
-1; |
(*s_etat_processus).var_volatile_traitement_sigint = 0; |
|
|
|
if ((*s_etat_processus).profilage == d_vrai) |
|
{ |
|
profilage(s_etat_processus, "ATEXIT"); |
|
} |
|
|
if (evaluation(s_etat_processus, |
if (evaluation(s_etat_processus, |
(*s_etat_processus).at_exit, 'E') == d_erreur) |
(*s_etat_processus).at_exit, 'E') == d_erreur) |
Line 192 lancement_thread(void *argument)
|
Line 227 lancement_thread(void *argument)
|
d_ex_erreur_evaluation; |
d_ex_erreur_evaluation; |
} |
} |
} |
} |
|
|
|
if ((*s_etat_processus).profilage == d_vrai) |
|
{ |
|
profilage(s_etat_processus, NULL); |
|
} |
} |
} |
} |
} |
} |
} |
Line 207 lancement_thread(void *argument)
|
Line 247 lancement_thread(void *argument)
|
pthread_cancel((*s_etat_processus).thread_fusible); |
pthread_cancel((*s_etat_processus).thread_fusible); |
} |
} |
|
|
tid_final = -2; |
caractere = 0; |
|
|
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_elements_attente[1], |
&tid_final, sizeof(tid_final))) != sizeof(tid_final)) |
&caractere, sizeof(caractere))) != sizeof(caractere)) |
{ |
|
if (longueur_ecriture == -1) |
|
{ |
|
break; |
|
} |
|
} |
|
|
|
while((longueur_ecriture = write_atomic(s_etat_processus, |
|
(*s_argument_thread).pipe_nombre_objets_attente[1], |
|
&tid_final, sizeof(tid_final))) != sizeof(tid_final)) |
|
{ |
{ |
if (longueur_ecriture == -1) |
if (longueur_ecriture == -1) |
{ |
{ |
Line 250 lancement_thread(void *argument)
|
Line 280 lancement_thread(void *argument)
|
{ |
{ |
while((longueur_ecriture = write_atomic(s_etat_processus, |
while((longueur_ecriture = write_atomic(s_etat_processus, |
(*s_argument_thread).pipe_erreurs[1], |
(*s_argument_thread).pipe_erreurs[1], |
&((*s_etat_processus).erreur_execution), |
(int *) &((*s_etat_processus).erreur_execution), |
sizeof((*s_etat_processus).erreur_execution))) != |
sizeof((*s_etat_processus).erreur_execution))) != |
sizeof((*s_etat_processus).erreur_execution)) |
sizeof((*s_etat_processus).erreur_execution)) |
{ |
{ |
Line 282 lancement_thread(void *argument)
|
Line 312 lancement_thread(void *argument)
|
{ |
{ |
while((longueur_ecriture = write_atomic(s_etat_processus, |
while((longueur_ecriture = write_atomic(s_etat_processus, |
(*s_argument_thread).pipe_erreurs[1], |
(*s_argument_thread).pipe_erreurs[1], |
&((*s_etat_processus).erreur_systeme), |
(int *) &((*s_etat_processus).erreur_systeme), |
sizeof((*s_etat_processus).erreur_systeme))) != |
sizeof((*s_etat_processus).erreur_systeme))) != |
sizeof((*s_etat_processus).erreur_systeme)) |
sizeof((*s_etat_processus).erreur_systeme)) |
{ |
{ |
Line 322 lancement_thread(void *argument)
|
Line 352 lancement_thread(void *argument)
|
} |
} |
} |
} |
|
|
close((*s_argument_thread).pipe_erreurs[1]); |
|
close((*s_argument_thread).pipe_interruptions[1]); |
|
close((*s_argument_thread).pipe_nombre_interruptions_attente[1]); |
|
close((*s_argument_thread).pipe_objets[1]); |
|
close((*s_argument_thread).pipe_nombre_objets_attente[1]); |
|
close((*s_argument_thread).pipe_injections[0]); |
|
close((*s_argument_thread).pipe_nombre_injections[0]); |
|
close((*s_argument_thread).pipe_acquittement[0]); |
|
|
|
l_element_courant = (*s_etat_processus).s_fichiers; |
l_element_courant = (*s_etat_processus).s_fichiers; |
|
|
while(l_element_courant != NULL) |
while(l_element_courant != NULL) |
Line 366 lancement_thread(void *argument)
|
Line 387 lancement_thread(void *argument)
|
l_element_courant = l_element_suivant; |
l_element_courant = l_element_suivant; |
} |
} |
|
|
pthread_mutex_lock(&((*s_etat_processus).mutex)); |
pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)); |
|
|
l_element_courant = (struct_liste_chainee *) |
l_element_courant = (struct_liste_chainee *) |
(*s_etat_processus).l_base_pile_processus; |
(*s_etat_processus).l_base_pile_processus; |
Line 403 lancement_thread(void *argument)
|
Line 424 lancement_thread(void *argument)
|
{ |
{ |
envoi_signal_processus((*(*((struct_processus_fils *) |
envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant) |
(*(*l_element_courant) |
.donnee).objet)).thread).pid, rpl_sigurg); |
.donnee).objet)).thread).pid, rpl_sigurg, d_faux); |
} |
} |
else |
else |
{ |
{ |
Line 411 lancement_thread(void *argument)
|
Line 432 lancement_thread(void *argument)
|
{ |
{ |
envoi_signal_processus((*(*((struct_processus_fils *) |
envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant) |
(*(*l_element_courant) |
.donnee).objet)).thread).pid, rpl_sigabort); |
.donnee).objet)).thread).pid, rpl_sigabort, d_faux); |
} |
} |
else |
else |
{ |
{ |
envoi_signal_processus((*(*((struct_processus_fils *) |
envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant) |
(*(*l_element_courant) |
.donnee).objet)).thread).pid, rpl_sigstop); |
.donnee).objet)).thread).pid, rpl_sigstop,d_faux); |
} |
} |
} |
} |
} |
} |
Line 452 lancement_thread(void *argument)
|
Line 473 lancement_thread(void *argument)
|
(*(*l_element_courant).donnee).objet)).thread).mutex)) |
(*(*l_element_courant).donnee).objet)).thread).mutex)) |
!= 0) |
!= 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
|
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
Line 467 lancement_thread(void *argument)
|
Line 489 lancement_thread(void *argument)
|
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.thread_actif == d_vrai) |
.thread_actif == d_vrai) |
{ |
{ |
envoi_signal_thread((*(*((struct_processus_fils *) |
envoi_signal_thread(NULL, |
|
(*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread).tid, |
(*(*l_element_courant).donnee).objet)).thread).tid, |
rpl_sigurg); |
rpl_sigurg); |
} |
} |
Line 476 lancement_thread(void *argument)
|
Line 499 lancement_thread(void *argument)
|
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.mutex)) != 0) |
.mutex)) != 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
|
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
Line 493 lancement_thread(void *argument)
|
Line 517 lancement_thread(void *argument)
|
(*(*l_element_courant).donnee).objet)).thread).mutex)) |
(*(*l_element_courant).donnee).objet)).thread).mutex)) |
!= 0) |
!= 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
|
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
Line 510 lancement_thread(void *argument)
|
Line 535 lancement_thread(void *argument)
|
{ |
{ |
if ((*s_etat_processus).arret_depuis_abort == -1) |
if ((*s_etat_processus).arret_depuis_abort == -1) |
{ |
{ |
envoi_signal_thread((*(*((struct_processus_fils *) |
envoi_signal_thread(NULL, |
|
(*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.tid, rpl_sigabort); |
.tid, rpl_sigabort); |
} |
} |
else |
else |
{ |
{ |
envoi_signal_thread((*(*((struct_processus_fils *) |
envoi_signal_thread(NULL, |
|
(*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.tid, rpl_sigstop); |
.tid, rpl_sigstop); |
} |
} |
Line 526 lancement_thread(void *argument)
|
Line 553 lancement_thread(void *argument)
|
(*(*l_element_courant).donnee).objet)).thread).mutex)) |
(*(*l_element_courant).donnee).objet)).thread).mutex)) |
!= 0) |
!= 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
|
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
Line 563 lancement_thread(void *argument)
|
Line 591 lancement_thread(void *argument)
|
.var_volatile_traitement_retarde_stop; |
.var_volatile_traitement_retarde_stop; |
(*s_etat_processus).var_volatile_traitement_retarde_stop = 1; |
(*s_etat_processus).var_volatile_traitement_retarde_stop = 1; |
|
|
for(i = 0; i < (unsigned long) (*(*((struct_processus_fils *) |
for(i = 0; i < (*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.nombre_objets_dans_pipe; i++) |
.nombre_objets_dans_pipe; i++) |
{ |
{ |
Line 576 lancement_thread(void *argument)
|
Line 604 lancement_thread(void *argument)
|
(*(*((struct_processus_fils *) (*(*l_element_courant) |
(*(*((struct_processus_fils *) (*(*l_element_courant) |
.donnee).objet)).thread).nombre_objets_dans_pipe--; |
.donnee).objet)).thread).nombre_objets_dans_pipe--; |
|
|
|
if (pthread_mutex_lock(&mutex_sigaction) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_exit(NULL); |
|
} |
|
|
action.sa_handler = SIG_IGN; |
action.sa_handler = SIG_IGN; |
action.sa_flags = SA_ONSTACK; |
action.sa_flags = 0; |
|
|
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
if (sigaction(SIGPIPE, &action, ®istre) != 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
if (registre_stop == 0) |
if (registre_stop == 0) |
{ |
{ |
Line 599 lancement_thread(void *argument)
|
Line 635 lancement_thread(void *argument)
|
} |
} |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
exit(EXIT_FAILURE); |
pthread_exit(NULL); |
} |
} |
|
|
while((longueur_ecriture = write_atomic( |
while((longueur_ecriture = write_atomic( |
Line 632 lancement_thread(void *argument)
|
Line 668 lancement_thread(void *argument)
|
|
|
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
if (sigaction(SIGPIPE, ®istre, NULL) != 0) |
{ |
{ |
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&mutex_sigaction); |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
(*s_etat_processus).erreur_systeme = d_es_signal; |
exit(EXIT_FAILURE); |
pthread_exit(NULL); |
|
} |
|
|
|
if (pthread_mutex_unlock(&mutex_sigaction) != 0) |
|
{ |
|
pthread_mutex_unlock(&((*s_etat_processus) |
|
.mutex_pile_processus)); |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_signal; |
|
pthread_exit(NULL); |
} |
} |
} |
} |
} |
} |
Line 650 lancement_thread(void *argument)
|
Line 697 lancement_thread(void *argument)
|
} |
} |
} |
} |
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
if (pthread_mutex_lock(&((*s_etat_processus).mutex_interruptions)) != 0) |
|
{ |
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_exit(NULL); |
|
} |
|
|
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
if ((*s_etat_processus).nombre_interruptions_non_affectees != 0) |
{ |
{ |
affectation_interruptions_logicielles(s_etat_processus); |
affectation_interruptions_logicielles(s_etat_processus); |
} |
} |
|
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex_interruptions)) |
|
!= 0) |
|
{ |
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_exit(NULL); |
|
} |
|
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
nanosleep(&attente, NULL); |
nanosleep(&attente, NULL); |
pthread_mutex_lock(&((*s_etat_processus).mutex)); |
pthread_mutex_lock(&((*s_etat_processus).mutex_pile_processus)); |
} |
} |
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
|
|
l_element_courant = (*s_etat_processus).s_sockets; |
l_element_courant = (*s_etat_processus).s_sockets; |
|
|
Line 801 lancement_thread(void *argument)
|
Line 864 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 978 lancement_thread(void *argument)
|
Line 1042 lancement_thread(void *argument)
|
liberation_profil(s_etat_processus); |
liberation_profil(s_etat_processus); |
} |
} |
|
|
liberation_allocateur(s_etat_processus); |
|
|
|
retrait_thread(s_etat_processus); |
retrait_thread(s_etat_processus); |
pthread_mutex_destroy(&((*s_etat_processus).mutex)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions)); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux)); |
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
|
sem_post(&((*s_etat_processus).semaphore_fork)); |
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_post((*s_etat_processus).semaphore_fork); |
|
sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
# endif |
# endif |
|
|
|
close((*s_argument_thread).pipe_erreurs[1]); |
|
close((*s_argument_thread).pipe_interruptions[1]); |
|
close((*s_argument_thread).pipe_nombre_elements_attente[1]); |
|
close((*s_argument_thread).pipe_objets[1]); |
|
close((*s_argument_thread).pipe_injections[0]); |
|
close((*s_argument_thread).pipe_nombre_injections[0]); |
|
close((*s_argument_thread).pipe_acquittement[0]); |
|
|
liberation_contexte_cas(s_etat_processus); |
liberation_contexte_cas(s_etat_processus); |
free((*s_etat_processus).localisation); |
free((*s_etat_processus).localisation); |
free(s_etat_processus); |
liberation_allocateur(s_etat_processus); |
|
liberation_allocateur_buffer(s_etat_processus); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation_buffer)); |
|
sys_free(s_etat_processus); |
|
|
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
pthread_mutex_lock(&((*s_argument_thread).mutex)); |
|
(*s_argument_thread).thread_actif = d_faux; |
pthread_mutex_unlock(&((*s_argument_thread).mutex)); |
pthread_mutex_unlock(&((*s_argument_thread).mutex)); |
|
|
(*s_argument_thread).thread_actif = d_faux; |
|
pthread_exit(NULL); |
pthread_exit(NULL); |
return(NULL); |
|
} |
} |
|
|
// vim: ts=4 |
// vim: ts=4 |