version 1.88, 2011/11/30 12:15:18
|
version 1.95, 2012/05/16 14:45:25
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.5 |
RPL/2 (R) version 4.1.8 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 64 unsigned char *racine_segment;
|
Line 64 unsigned char *racine_segment;
|
static pthread_mutex_t mutex_interruptions |
static pthread_mutex_t mutex_interruptions |
= PTHREAD_MUTEX_INITIALIZER; |
= PTHREAD_MUTEX_INITIALIZER; |
|
|
|
void * |
|
thread_surveillance_signaux(void *argument) |
|
{ |
|
// Chaque kill() ou pthread_kill() incrémente le sémaphore. Lorsque le |
|
// sémaphore est déverrouillé, on part dans un timeout. |
|
// while(sem_wait()) |
|
// { |
|
// nanosleep(); |
|
// if (errno == EINTR) |
|
// { |
|
// continue; |
|
// } |
|
// |
|
// if (sem_trywait() != 0) |
|
// { |
|
// sem_post() |
|
// kill() |
|
// } |
|
// } |
|
pthread_exit(NULL); |
|
} |
|
|
void |
void |
modification_pid_thread_pere(struct_processus *s_etat_processus) |
modification_pid_thread_pere(struct_processus *s_etat_processus) |
{ |
{ |
Line 2274 scrutation_interruptions(struct_processu
|
Line 2296 scrutation_interruptions(struct_processu
|
if (sem_trywait(semaphore_queue_signaux) == 0) |
if (sem_trywait(semaphore_queue_signaux) == 0) |
# endif |
# endif |
{ |
{ |
if ((*s_queue_signaux).pointeur_lecture != |
while((*s_queue_signaux).pointeur_lecture != |
(*s_queue_signaux).pointeur_ecriture) |
(*s_queue_signaux).pointeur_ecriture) |
{ |
{ |
// Il y a un signal en attente dans le segment partagé. On le |
// Il y a un signal en attente dans le segment partagé. On le |
Line 2300 scrutation_interruptions(struct_processu
|
Line 2322 scrutation_interruptions(struct_processu
|
|
|
if (pthread_mutex_trylock(&mutex_interruptions) == 0) |
if (pthread_mutex_trylock(&mutex_interruptions) == 0) |
{ |
{ |
if ((*s_etat_processus).pointeur_signal_lecture != |
while((*s_etat_processus).pointeur_signal_lecture != |
(*s_etat_processus).pointeur_signal_ecriture) |
(*s_etat_processus).pointeur_signal_ecriture) |
{ |
{ |
// Il y a un signal dans la queue du thread courant. On le traite. |
// Il y a un signal dans la queue du thread courant. On le traite. |
Line 2599 envoi_signal_processus(pid_t pid, enum s
|
Line 2621 envoi_signal_processus(pid_t pid, enum s
|
# endif |
# endif |
} |
} |
|
|
|
kill(pid, SIGALRM); |
|
|
return(0); |
return(0); |
} |
} |
|
|
Line 2662 envoi_signal_thread(pthread_t tid, enum
|
Line 2686 envoi_signal_thread(pthread_t tid, enum
|
return(1); |
return(1); |
} |
} |
|
|
|
pthread_kill(tid, SIGALRM); |
|
|
return(0); |
return(0); |
} |
} |
|
|
Line 2678 envoi_signal_contexte(struct_processus *
|
Line 2704 envoi_signal_contexte(struct_processus *
|
% LONGUEUR_QUEUE_SIGNAUX; |
% LONGUEUR_QUEUE_SIGNAUX; |
pthread_mutex_unlock(&mutex_interruptions); |
pthread_mutex_unlock(&mutex_interruptions); |
|
|
|
pthread_kill((*s_etat_processus_a_signaler).tid, SIGALRM); |
|
|
return(0); |
return(0); |
} |
} |
|
|