--- rpl/src/instructions_s1.c 2019/02/11 09:45:52 1.101 +++ 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,17 +3673,38 @@ instruction_syseval(struct_processus *s_ fflush(NULL); - verrouillage_threads_concurrents(s_etat_processus); - - action_courante.sa_handler = SIG_IGN; - action_courante.sa_flags = 0; + attente.tv_sec = 0; + attente.tv_nsec = GRANULARITE_us * 1000; - if (pthread_mutex_lock(&mutex_sigaction) != 0) + while(pthread_mutex_trylock(&mutex_sigaction) != 0) { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; +# 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; + if (sigaction(SIGINT, &action_courante, &action_passee) != 0) { for(i = 0; i < nombre_arguments; i++) @@ -3696,6 +3719,8 @@ instruction_syseval(struct_processus *s_ return; } + verrouillage_threads_concurrents(s_etat_processus); + pid = fork(); if (pid < 0)