--- rpl/src/interruptions.c 2016/04/01 13:33:27 1.178 +++ 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); } @@ -2494,11 +2505,6 @@ scrutation_interruptions(struct_processu return; } } - - if ((*s_queue_signaux).requete_arret == d_vrai) - { - break; - } } sem_post(semaphore_queue_signaux); @@ -2737,11 +2743,26 @@ envoi_signal_processus(pid_t pid, enum s queue = shmat(segment, NULL, 0); # else // OS/2 - if (DosGetNamedSharedMem((PVOID) &queue, nom, - PAG_WRITE | PAG_READ) != 0) + if (test_ouverture == d_vrai) { - sys_free(nom); - return(1); + attente.tv_sec = 0; + attente.tv_nsec = GRANULARITE_us * 1000; + + while(DosGetNamedSharedMem((PVOID) &queue, nom, + PAG_WRITE | PAG_READ) != 0) + { + nanosleep(&attente, NULL); + INCR_GRANULARITE(attente.tv_nsec); + } + } + else + { + if (DosGetNamedSharedMem((PVOID) &queue, nom, + PAG_WRITE | PAG_READ) != 0) + { + sys_free(nom); + return(1); + } } sys_free(nom); @@ -3401,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();