--- rpl/src/instructions_s8.c 2010/01/26 15:22:45 1.1 +++ rpl/src/instructions_s8.c 2011/09/20 09:51:43 1.37 @@ -1,7 +1,7 @@ /* ================================================================================ - RPL/2 (R) version 4.0.9 - Copyright (C) 1989-2010 Dr. BERTRAND Joël + RPL/2 (R) version 4.1.3 + Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -20,7 +20,7 @@ */ -#include "rpl.conv.h" +#include "rpl-conv.h" /* @@ -257,7 +257,7 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).pipe_nombre_objets_attente, &pid, sizeof(pid))) != sizeof(pid)) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -280,11 +280,14 @@ instruction_send(struct_processus *s_eta nanosleep(&attente, NULL); INCR_GRANULARITE(attente.tv_nsec); - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) + if (sem_post(&((*s_etat_processus).semaphore_fork)) + != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } + + scrutation_interruptions(s_etat_processus); } pid = getpid(); @@ -296,7 +299,7 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).pipe_nombre_objets_attente, &pid, sizeof(pid))) != sizeof(pid)) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -324,9 +327,11 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + + scrutation_interruptions(s_etat_processus); } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -362,13 +367,10 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).pipe_nombre_objets_attente, &tid, sizeof(tid))) != sizeof(tid)) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { - if (errno != EINTR) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + (*s_etat_processus).erreur_systeme = d_es_processus; + return; } if (longueur_ecriture == -1) @@ -390,6 +392,8 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + + scrutation_interruptions(s_etat_processus); } tid = pthread_self(); @@ -401,7 +405,7 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).pipe_nombre_objets_attente, &tid, sizeof(tid))) != sizeof(tid)) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -429,15 +433,14 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + + scrutation_interruptions(s_etat_processus); } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) { - if (errno != EINTR) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + (*s_etat_processus).erreur_systeme = d_es_processus; + return; } } @@ -455,7 +458,7 @@ instruction_send(struct_processus *s_eta while(read_atomic(s_etat_processus, (*s_etat_processus).pipe_acquittement, &tampon, sizeof(unsigned char)) != sizeof(unsigned char)) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -472,9 +475,11 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + + scrutation_interruptions(s_etat_processus); } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -503,13 +508,10 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).pipe_nombre_interruptions_attente, &pid, sizeof(pid))) != sizeof(pid)) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) { - if (errno != EINTR) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } + (*s_etat_processus).erreur_systeme = d_es_processus; + return; } if (longueur_ecriture == -1) @@ -533,7 +535,7 @@ instruction_send(struct_processus *s_eta } } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -541,6 +543,8 @@ instruction_send(struct_processus *s_eta return; } } + + scrutation_interruptions(s_etat_processus); } else { @@ -559,7 +563,7 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).pipe_nombre_interruptions_attente, &tid, sizeof(tid))) != sizeof(tid)) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -587,9 +591,11 @@ instruction_send(struct_processus *s_eta (*s_etat_processus).erreur_systeme = d_es_processus; return; } + + scrutation_interruptions(s_etat_processus); } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -610,7 +616,7 @@ instruction_send(struct_processus *s_eta if (ecriture_pipe(s_etat_processus, (*s_etat_processus).pipe_donnees, s_objet) == d_erreur) { - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -628,7 +634,7 @@ instruction_send(struct_processus *s_eta return; } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) == -1) + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) { if (errno != EINTR) { @@ -1330,11 +1336,6 @@ instruction_stop(struct_processus *s_eta struct_objet *s_objet; - struct timespec attente; - - attente.tv_sec = 0; - attente.tv_nsec = GRANULARITE_us * 1000; - (*s_etat_processus).erreur_execution = d_ex; if ((*s_etat_processus).affichage_arguments == 'Y') @@ -1380,8 +1381,8 @@ instruction_stop(struct_processus *s_eta if ((*(*((struct_processus_fils *) (*s_objet).objet)).thread) .processus_detache == d_vrai) { - kill((*(*((struct_processus_fils *) (*s_objet).objet)).thread).pid, - SIGFSTOP); + envoi_signal_processus((*(*((struct_processus_fils *) + (*s_objet).objet)).thread).pid, rpl_sigstop); } else { @@ -1400,7 +1401,7 @@ instruction_stop(struct_processus *s_eta .donnee).objet)).thread).processus_detache == d_faux) { if ((pthread_equal((*(*((struct_processus_fils *) - (*(*l_element_courant).donnee).objet)).thread).pid, + (*(*l_element_courant).donnee).objet)).thread).tid, (*(*((struct_processus_fils *) (*s_objet).objet)).thread).tid) != 0) && ((*(*((struct_processus_fils *) @@ -1441,8 +1442,8 @@ instruction_stop(struct_processus *s_eta if ((*(*((struct_processus_fils *) (*s_objet).objet)).thread).thread_actif == d_vrai) { - pthread_kill((*(*((struct_processus_fils *) - (*s_objet).objet)).thread).tid, SIGFSTOP); + envoi_signal_thread((*(*((struct_processus_fils *) + (*s_objet).objet)).thread).tid, rpl_sigstop); } if (pthread_mutex_unlock(&((*(*((struct_processus_fils *)