--- rpl/src/instructions_d5.c 2011/09/15 17:51:43 1.69 +++ rpl/src/instructions_d5.c 2011/10/04 19:32:35 1.76 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.1.3 + RPL/2 (R) version 4.1.4 Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -1231,28 +1231,30 @@ instruction_detach(struct_processus *s_e return; } -# ifndef OS2 -# ifndef Cygwin +# ifdef SCHED_OTHER if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_EXPLICIT_SCHED if (pthread_attr_setinheritsched(&attributs, PTHREAD_EXPLICIT_SCHED) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_SCOPE_SYSTEM if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } # endif -# endif (*s_argument_thread).s_etat_processus = s_etat_processus; @@ -1277,6 +1279,7 @@ instruction_detach(struct_processus *s_e liberation_queue_signaux(s_etat_processus); creation_queue_signaux(s_etat_processus); + routine_recursive = 0; (*s_etat_processus).pointeur_signal_lecture = 0; (*s_etat_processus).pointeur_signal_ecriture = 0; @@ -2768,8 +2771,14 @@ instruction_detach(struct_processus *s_e pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); - pthread_mutex_unlock(&((*s_etat_processus).mutex_fork)); - pthread_mutex_destroy(&((*s_etat_processus).mutex_fork)); +# ifndef SEMAPHORES_NOMMES + sem_post(&((*s_etat_processus).semaphore_fork)); + sem_destroy(&((*s_etat_processus).semaphore_fork)); +# else + sem_post((*s_etat_processus).semaphore_fork); + sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), + pthread_self(), SEM_FORK); +# endif free((*s_etat_processus).localisation); free(s_argument_thread); @@ -2874,25 +2883,6 @@ instruction_detach(struct_processus *s_e close(pipe_initialisation_segment_signaux[0]); close(pipe_initialisation_segment_signaux[1]); - // Être sûr que le processus fils soit déjà présent... - - attente.tv_sec = 0; - attente.tv_nsec = GRANULARITE_us * 1000; - - while(envoi_signal_processus((*s_argument_thread).pid, rpl_signull) != 0) - { - if (errno != ENOENT) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - pthread_mutex_unlock(&((*s_etat_processus).mutex)); - return; - } - - scrutation_interruptions(s_etat_processus); - nanosleep(&attente, NULL); - INCR_GRANULARITE(attente.tv_nsec); - } - // 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)