--- rpl/src/gestion_threads.c 2011/09/20 14:36:29 1.53 +++ rpl/src/gestion_threads.c 2012/10/04 15:21:26 1.67 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.1.3 - Copyright (C) 1989-2011 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.11 + Copyright (C) 1989-2012 Dr. BERTRAND Joël This file is part of RPL/2. @@ -73,6 +73,18 @@ lancement_thread(void *argument) s_argument_thread = (struct_descripteur_thread *) argument; 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).thread_actif = d_vrai; @@ -92,7 +104,7 @@ lancement_thread(void *argument) (*s_argument_thread).thread_actif = d_faux; - tid_final = -2; + tid_final = (pthread_t) -2; while((longueur_ecriture = write_atomic(s_etat_processus, (*s_argument_thread).pipe_nombre_interruptions_attente[1], @@ -207,7 +219,7 @@ lancement_thread(void *argument) pthread_cancel((*s_etat_processus).thread_fusible); } - tid_final = -2; + tid_final = (pthread_t) -2; while((longueur_ecriture = write_atomic(s_etat_processus, (*s_argument_thread).pipe_nombre_interruptions_attente[1], @@ -801,6 +813,8 @@ lancement_thread(void *argument) liberation_arbre_variables(s_etat_processus, (*s_etat_processus).s_arbre_variables, d_faux); +#warning A FAIRE + /* for(i = 0; i < (*s_etat_processus).nombre_variables_statiques; i++) { liberation(s_etat_processus, @@ -809,6 +823,7 @@ lancement_thread(void *argument) } free((*s_etat_processus).s_liste_variables_statiques); + */ l_element_courant = (*s_etat_processus).l_base_pile; while(l_element_courant != NULL) @@ -987,7 +1002,8 @@ lancement_thread(void *argument) # ifndef SEMAPHORES_NOMMES sem_destroy(&((*s_etat_processus).semaphore_fork)); # else - sem_destroy2((*s_etat_processus).semaphore_fork, getpid()); + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), + pthread_self(), SEM_FORK); # endif liberation_contexte_cas(s_etat_processus);