version 1.179, 2016/04/06 21:14:56
|
version 1.181, 2016/07/21 15:22:53
|
Line 93 thread_surveillance_signaux(void *argume
|
Line 93 thread_surveillance_signaux(void *argume
|
|
|
if (sem_wait(semaphore_signalisation) == 0) |
if (sem_wait(semaphore_signalisation) == 0) |
{ |
{ |
if (sem_wait(semaphore_arret_signalisation) != 0) |
while((ios = sem_wait(semaphore_arret_signalisation)) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
} |
} |
} |
|
|
if ((*s_queue_signaux).requete_arret == d_vrai) |
if ((*s_queue_signaux).requete_arret == d_vrai) |
Line 1549 lancement_thread_signaux(struct_processu
|
Line 1552 lancement_thread_signaux(struct_processu
|
return(d_erreur); |
return(d_erreur); |
} |
} |
|
|
|
if (pthread_attr_destroy(&attributs) != 0) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return(d_erreur); |
|
} |
|
|
return(d_absence_erreur); |
return(d_absence_erreur); |
} |
} |
|
|
Line 1573 arret_thread_signaux(struct_processus *s
|
Line 1582 arret_thread_signaux(struct_processus *s
|
|
|
pthread_join((*s_etat_processus).thread_signaux, NULL); |
pthread_join((*s_etat_processus).thread_signaux, NULL); |
|
|
close((*s_etat_processus).pipe_signaux[0]); |
|
close((*s_etat_processus).pipe_signaux[1]); |
close((*s_etat_processus).pipe_signaux[1]); |
|
|
return(d_absence_erreur); |
return(d_absence_erreur); |
} |
} |
|
|
Line 1596 thread_signaux(void *argument)
|
Line 1603 thread_signaux(void *argument)
|
pipe = (*s_etat_processus).pipe_signaux; |
pipe = (*s_etat_processus).pipe_signaux; |
fds.fd = pipe[0]; |
fds.fd = pipe[0]; |
fds.events = POLLIN; |
fds.events = POLLIN; |
fds.revents = 0; |
|
|
|
sigfillset(&masque); |
sigfillset(&masque); |
pthread_sigmask(SIG_BLOCK, &masque, NULL); |
pthread_sigmask(SIG_BLOCK, &masque, NULL); |
|
|
do |
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) |
if (read_atomic(s_etat_processus, fds.fd, &signal, 1) != 1) |
{ |
{ |
|
close((*s_etat_processus).pipe_signaux[0]); |
pthread_exit(NULL); |
pthread_exit(NULL); |
} |
} |
|
|
Line 1621 thread_signaux(void *argument)
|
Line 1634 thread_signaux(void *argument)
|
} |
} |
} while(signal != (0xFF & rpl_sigmax)); |
} while(signal != (0xFF & rpl_sigmax)); |
|
|
|
close((*s_etat_processus).pipe_signaux[0]); |
pthread_exit(NULL); |
pthread_exit(NULL); |
} |
} |
|
|
Line 3411 creation_queue_signaux(struct_processus
|
Line 3425 creation_queue_signaux(struct_processus
|
return; |
return; |
} |
} |
|
|
# ifdef SCHED_OTHER |
if (pthread_create(&((*s_queue_signaux).thread_signaux), &attributs, |
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
thread_surveillance_signaux, s_etat_processus) != 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; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
# endif |
|
|
|
if (pthread_attr_destroy(&attributs) != 0) |
if (pthread_attr_destroy(&attributs) != 0) |
{ |
{ |
Line 3441 creation_queue_signaux(struct_processus
|
Line 3438 creation_queue_signaux(struct_processus
|
return; |
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(); |
(*s_queue_signaux).controle = getpid(); |
|
|
# ifndef IPCS_SYSV |
# ifndef IPCS_SYSV |
Line 3532 destruction_queue_signaux(struct_process
|
Line 3522 destruction_queue_signaux(struct_process
|
unsigned char *nom; |
unsigned char *nom; |
# endif |
# endif |
|
|
sem_wait(semaphore_arret_signalisation); |
while(sem_wait(semaphore_arret_signalisation) != 0) |
|
{ |
|
if (errno != EINTR) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
return; |
|
} |
|
} |
|
|
(*s_queue_signaux).requete_arret = d_vrai; |
(*s_queue_signaux).requete_arret = d_vrai; |
|
|
# ifndef IPCS_SYSV |
# ifndef IPCS_SYSV |