version 1.139, 2016/03/09 10:57:41
|
version 1.146, 2016/03/17 16:31:58
|
Line 1094 instruction_detach(struct_processus *s_e
|
Line 1094 instruction_detach(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
|
verrouillage_threads_concurrents(s_etat_processus); |
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex_allocation_buffer)) != 0) |
if (pthread_mutex_lock(&((*s_etat_processus).mutex_allocation_buffer)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
Line 1107 instruction_detach(struct_processus *s_e
|
Line 1109 instruction_detach(struct_processus *s_e
|
* de mémoire, ni libération, ni copie d'objet concurrent au fork(). |
* de mémoire, ni libération, ni copie d'objet concurrent au fork(). |
*/ |
*/ |
|
|
verrouillage_threads_concurrents(s_etat_processus); |
|
(*s_argument_thread).pid = fork(); |
(*s_argument_thread).pid = fork(); |
|
|
if ((*s_argument_thread).pid > 0) |
|
{ |
|
deverrouillage_threads_concurrents(s_etat_processus); |
|
} |
|
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex_allocation_buffer)) |
if (pthread_mutex_unlock(&((*s_etat_processus).mutex_allocation_buffer)) |
!= 0) |
!= 0) |
{ |
{ |
Line 1122 instruction_detach(struct_processus *s_e
|
Line 1118 instruction_detach(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
|
if ((*s_argument_thread).pid > 0) |
|
{ |
|
// On ne déverrouille les threads concurrents que dans le processus |
|
// père. Dans le fils, les valeurs sont non initialisées. |
|
deverrouillage_threads_concurrents(s_etat_processus); |
|
} |
|
|
(*s_argument_thread).thread_pere = pthread_self(); |
(*s_argument_thread).thread_pere = pthread_self(); |
(*s_argument_thread).processus_detache = d_vrai; |
(*s_argument_thread).processus_detache = d_vrai; |
|
|
Line 1286 instruction_detach(struct_processus *s_e
|
Line 1289 instruction_detach(struct_processus *s_e
|
*/ |
*/ |
|
|
pthread_mutex_destroy(&mutex_liste_variables_partagees); |
pthread_mutex_destroy(&mutex_liste_variables_partagees); |
|
pthread_mutex_destroy(&mutex_liste_threads); |
|
|
pthread_mutexattr_init(&attributs_mutex); |
pthread_mutexattr_init(&attributs_mutex); |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); |
pthread_mutex_init(&mutex_liste_variables_partagees, &attributs_mutex); |
pthread_mutex_init(&mutex_liste_variables_partagees, &attributs_mutex); |
pthread_mutexattr_destroy(&attributs_mutex); |
pthread_mutexattr_destroy(&attributs_mutex); |
|
|
pthread_mutex_destroy(&mutex_liste_threads); |
|
|
|
pthread_mutexattr_init(&attributs_mutex); |
pthread_mutexattr_init(&attributs_mutex); |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); |
pthread_mutexattr_settype(&attributs_mutex, PTHREAD_MUTEX_RECURSIVE); |
pthread_mutex_init(&mutex_liste_threads, &attributs_mutex); |
pthread_mutex_init(&mutex_liste_threads, &attributs_mutex); |
Line 2194 instruction_detach(struct_processus *s_e
|
Line 2196 instruction_detach(struct_processus *s_e
|
} |
} |
} |
} |
|
|
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]); |
|
|
|
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 2281 instruction_detach(struct_processus *s_e
|
Line 2275 instruction_detach(struct_processus *s_e
|
{ |
{ |
envoi_signal_processus((*(*((struct_processus_fils *) |
envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread).pid, |
(*(*l_element_courant).donnee).objet)).thread).pid, |
rpl_sigurg); |
rpl_sigurg, d_faux); |
} |
} |
else |
else |
{ |
{ |
Line 2289 instruction_detach(struct_processus *s_e
|
Line 2283 instruction_detach(struct_processus *s_e
|
{ |
{ |
envoi_signal_processus((*(*((struct_processus_fils *) |
envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.pid, rpl_sigabort); |
.pid, rpl_sigabort, d_faux); |
} |
} |
else |
else |
{ |
{ |
envoi_signal_processus((*(*((struct_processus_fils *) |
envoi_signal_processus((*(*((struct_processus_fils *) |
(*(*l_element_courant).donnee).objet)).thread) |
(*(*l_element_courant).donnee).objet)).thread) |
.pid, rpl_sigstop); |
.pid, rpl_sigstop, d_faux); |
} |
} |
} |
} |
} |
} |
Line 2764 instruction_detach(struct_processus *s_e
|
Line 2758 instruction_detach(struct_processus *s_e
|
l_element_courant = l_element_suivant; |
l_element_courant = l_element_suivant; |
} |
} |
|
|
free((*s_etat_processus).chemin_fichiers_temporaires); |
|
|
|
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 2819 instruction_detach(struct_processus *s_e
|
Line 2811 instruction_detach(struct_processus *s_e
|
|
|
closelog(); |
closelog(); |
|
|
retrait_thread(s_etat_processus); |
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]); |
|
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus)); |
retrait_thread(s_etat_processus); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions)); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux)); |
|
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |
|
pthread_mutex_destroy(&mutex_sections_critiques); |
|
|
|
# ifndef SEMAPHORES_NOMMES |
# ifndef SEMAPHORES_NOMMES |
sem_post(&((*s_etat_processus).semaphore_fork)); |
sem_post(&((*s_etat_processus).semaphore_fork)); |
Line 2837 instruction_detach(struct_processus *s_e
|
Line 2830 instruction_detach(struct_processus *s_e
|
pthread_self(), SEM_FORK); |
pthread_self(), SEM_FORK); |
# endif |
# endif |
|
|
free((*s_etat_processus).localisation); |
|
free(s_argument_thread); |
|
|
|
clear_history(); |
clear_history(); |
|
|
destruction_queue_signaux(s_etat_processus); |
|
liberation_contexte_cas(s_etat_processus); |
liberation_contexte_cas(s_etat_processus); |
arret_thread_signaux(s_etat_processus); |
destruction_queue_signaux(s_etat_processus); |
|
|
|
free((*s_etat_processus).localisation); |
|
free((*s_etat_processus).chemin_fichiers_temporaires); |
|
free(s_argument_thread); |
|
|
liberation_allocateur(s_etat_processus); |
liberation_allocateur(s_etat_processus); |
liberation_allocateur_buffer(s_etat_processus); |
liberation_allocateur_buffer(s_etat_processus); |
|
|
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_pile_processus)); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_interruptions)); |
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_signaux)); |
|
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation_buffer)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation_buffer)); |
|
pthread_mutex_destroy(&mutex_sections_critiques); |
|
|
sys_free(s_etat_processus); |
sys_free(s_etat_processus); |
|
|
# ifdef DEBUG_MEMOIRE |
# ifdef DEBUG_MEMOIRE |
Line 2948 instruction_detach(struct_processus *s_e
|
Line 2950 instruction_detach(struct_processus *s_e
|
|
|
// 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. |
|
|
if (envoi_signal_processus((*s_argument_thread).pid, rpl_sigstart) != 0) |
if (envoi_signal_processus((*s_argument_thread).pid, rpl_sigstart, |
|
d_vrai) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |
pthread_mutex_unlock(&((*s_etat_processus).mutex_pile_processus)); |