--- rpl/src/interruptions.c 2016/04/06 21:14:56 1.179 +++ rpl/src/interruptions.c 2016/07/20 16:23:59 1.180 @@ -1549,6 +1549,12 @@ lancement_thread_signaux(struct_processu return(d_erreur); } + if (pthread_attr_destroy(&attributs) != 0) + { + (*s_etat_processus).erreur_systeme = d_es_processus; + return(d_erreur); + } + return(d_absence_erreur); } @@ -1573,9 +1579,7 @@ arret_thread_signaux(struct_processus *s pthread_join((*s_etat_processus).thread_signaux, NULL); - close((*s_etat_processus).pipe_signaux[0]); close((*s_etat_processus).pipe_signaux[1]); - return(d_absence_erreur); } @@ -1596,20 +1600,26 @@ thread_signaux(void *argument) pipe = (*s_etat_processus).pipe_signaux; fds.fd = pipe[0]; fds.events = POLLIN; - fds.revents = 0; sigfillset(&masque); pthread_sigmask(SIG_BLOCK, &masque, NULL); do { - if (poll(&fds, 1, -1) == -1) + fds.revents = 0; + + while(poll(&fds, 1, -1) == -1) { - pthread_exit(NULL); + if (errno != EINTR) + { + close((*s_etat_processus).pipe_signaux[0]); + pthread_exit(NULL); + } } if (read_atomic(s_etat_processus, fds.fd, &signal, 1) != 1) { + close((*s_etat_processus).pipe_signaux[0]); pthread_exit(NULL); } @@ -1621,6 +1631,7 @@ thread_signaux(void *argument) } } while(signal != (0xFF & rpl_sigmax)); + close((*s_etat_processus).pipe_signaux[0]); pthread_exit(NULL); } @@ -3411,41 +3422,17 @@ creation_queue_signaux(struct_processus return; } -# 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) + if (pthread_create(&((*s_queue_signaux).thread_signaux), &attributs, + thread_surveillance_signaux, s_etat_processus) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } -# endif if (pthread_attr_destroy(&attributs) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; - } - - if (pthread_create(&((*s_queue_signaux).thread_signaux), &attributs, - thread_surveillance_signaux, s_etat_processus) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; } (*s_queue_signaux).controle = getpid();