--- rpl/src/instructions_s1.c 2019/02/09 13:36:40 1.100 +++ rpl/src/instructions_s1.c 2019/02/12 14:38:43 1.102 @@ -3406,6 +3406,8 @@ instruction_syseval(struct_processus *s_ struct sigaction action_courante; struct sigaction action_passee; + struct timespec attente; + unsigned char *ligne; unsigned char *ptr; unsigned char *ptr2; @@ -3671,7 +3673,34 @@ instruction_syseval(struct_processus *s_ fflush(NULL); - verrouillage_threads_concurrents(s_etat_processus); + attente.tv_sec = 0; + attente.tv_nsec = GRANULARITE_us * 1000; + + while(pthread_mutex_trylock(&mutex_sigaction) != 0) + { +# ifndef SEMAPHORES_NOMMES + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) +# else + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + + nanosleep(&attente, NULL); + INCR_GRANULARITE(attente.tv_nsec); + +# ifndef SEMAPHORES_NOMMES + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) +# else + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) +# endif + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + } action_courante.sa_handler = SIG_IGN; action_courante.sa_flags = 0; @@ -3690,6 +3719,8 @@ instruction_syseval(struct_processus *s_ return; } + verrouillage_threads_concurrents(s_etat_processus); + pid = fork(); if (pid < 0) @@ -3837,6 +3868,12 @@ instruction_syseval(struct_processus *s_ return; } + if (pthread_mutex_unlock(&mutex_sigaction) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return; + } + deverrouillage_threads_concurrents(s_etat_processus); if (close(pipes_entree[0]) != 0)