version 1.75, 2011/09/19 17:33:17
|
version 1.77, 2011/09/20 08:56:24
|
Line 324 verrouillage_threads_concurrents(struct_
|
Line 324 verrouillage_threads_concurrents(struct_
|
== getpid()) && (pthread_equal((*((struct_thread *) |
== getpid()) && (pthread_equal((*((struct_thread *) |
(*l_element_courant).donnee)).tid, pthread_self()) == 0)) |
(*l_element_courant).donnee)).tid, pthread_self()) == 0)) |
{ |
{ |
if (pthread_mutex_lock(&((*(*((struct_thread *) (*l_element_courant) |
if (sem_wait(&((*(*((struct_thread *) (*l_element_courant) |
.donnee)).s_etat_processus).mutex_fork)) == -1) |
.donnee)).s_etat_processus).semaphore_fork)) == -1) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
Line 351 deverrouillage_threads_concurrents(struc
|
Line 351 deverrouillage_threads_concurrents(struc
|
== getpid()) && (pthread_equal((*((struct_thread *) |
== getpid()) && (pthread_equal((*((struct_thread *) |
(*l_element_courant).donnee)).tid, pthread_self()) == 0)) |
(*l_element_courant).donnee)).tid, pthread_self()) == 0)) |
{ |
{ |
if (pthread_mutex_unlock(&((*(*((struct_thread *) |
if (sem_post(&((*(*((struct_thread *) |
(*l_element_courant).donnee)).s_etat_processus) |
(*l_element_courant).donnee)).s_etat_processus) |
.mutex_fork)) != 0) |
.semaphore_fork)) != 0) |
{ |
{ |
if (pthread_mutex_unlock(&mutex_liste_threads) != 0) |
if (pthread_mutex_unlock(&mutex_liste_threads) != 0) |
{ |
{ |
Line 1109 liberation_threads(struct_processus *s_e
|
Line 1109 liberation_threads(struct_processus *s_e
|
|
|
liberation_allocateur(s_etat_processus); |
liberation_allocateur(s_etat_processus); |
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_fork)); |
sem_post(&((*s_etat_processus).semaphore_fork)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_fork)); |
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
|
|
liberation_contexte_cas(s_etat_processus); |
liberation_contexte_cas(s_etat_processus); |
free(s_etat_processus); |
free(s_etat_processus); |
Line 1298 verrouillage_gestionnaire_signaux(struct
|
Line 1298 verrouillage_gestionnaire_signaux(struct
|
{ |
{ |
int semaphore; |
int semaphore; |
|
|
if (pthread_mutex_unlock(&((*s_etat_processus).mutex_fork)) != 0) |
if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
BUG(1, uprintf("Lock error !\n")); |
BUG(1, uprintf("Lock error !\n")); |
return; |
return; |
Line 1308 verrouillage_gestionnaire_signaux(struct
|
Line 1308 verrouillage_gestionnaire_signaux(struct
|
|
|
if (pthread_mutex_lock(&mutex_gestionnaires_signaux_atomique) != 0) |
if (pthread_mutex_lock(&mutex_gestionnaires_signaux_atomique) != 0) |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Unlock error !\n")); |
BUG(1, uprintf("Unlock error !\n")); |
return; |
return; |
} |
} |
Line 1319 verrouillage_gestionnaire_signaux(struct
|
Line 1319 verrouillage_gestionnaire_signaux(struct
|
if (sem_post(semaphore_gestionnaires_signaux) == -1) |
if (sem_post(semaphore_gestionnaires_signaux) == -1) |
# endif |
# endif |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Lock error !\n")); |
BUG(1, uprintf("Lock error !\n")); |
return; |
return; |
} |
} |
Line 1330 verrouillage_gestionnaire_signaux(struct
|
Line 1330 verrouillage_gestionnaire_signaux(struct
|
if (sem_getvalue(semaphore_gestionnaires_signaux, &semaphore) != 0) |
if (sem_getvalue(semaphore_gestionnaires_signaux, &semaphore) != 0) |
# endif |
# endif |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Lock error !\n")); |
BUG(1, uprintf("Lock error !\n")); |
return; |
return; |
} |
} |
|
|
if (pthread_mutex_unlock(&mutex_gestionnaires_signaux_atomique) != 0) |
if (pthread_mutex_unlock(&mutex_gestionnaires_signaux_atomique) != 0) |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Unlock error !\n")); |
BUG(1, uprintf("Unlock error !\n")); |
return; |
return; |
} |
} |
Line 1352 verrouillage_gestionnaire_signaux(struct
|
Line 1352 verrouillage_gestionnaire_signaux(struct
|
|
|
if (pthread_mutex_lock(&mutex_liste_threads) != 0) |
if (pthread_mutex_lock(&mutex_liste_threads) != 0) |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Lock error !\n")); |
BUG(1, uprintf("Lock error !\n")); |
return; |
return; |
} |
} |
Line 1370 deverrouillage_gestionnaire_signaux(stru
|
Line 1370 deverrouillage_gestionnaire_signaux(stru
|
|
|
if (pthread_mutex_lock(&mutex_gestionnaires_signaux_atomique) == -1) |
if (pthread_mutex_lock(&mutex_gestionnaires_signaux_atomique) == -1) |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Unlock error !\n")); |
BUG(1, uprintf("Unlock error !\n")); |
return; |
return; |
} |
} |
Line 1381 deverrouillage_gestionnaire_signaux(stru
|
Line 1381 deverrouillage_gestionnaire_signaux(stru
|
if (sem_getvalue(semaphore_gestionnaires_signaux, &semaphore) != 0) |
if (sem_getvalue(semaphore_gestionnaires_signaux, &semaphore) != 0) |
# endif |
# endif |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Unlock error !\n")); |
BUG(1, uprintf("Unlock error !\n")); |
return; |
return; |
} |
} |
Line 1394 deverrouillage_gestionnaire_signaux(stru
|
Line 1394 deverrouillage_gestionnaire_signaux(stru
|
{ |
{ |
if (errno != EINTR) |
if (errno != EINTR) |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Unlock error !\n")); |
BUG(1, uprintf("Unlock error !\n")); |
return; |
return; |
} |
} |
Line 1402 deverrouillage_gestionnaire_signaux(stru
|
Line 1402 deverrouillage_gestionnaire_signaux(stru
|
|
|
if (pthread_mutex_unlock(&mutex_gestionnaires_signaux_atomique) != 0) |
if (pthread_mutex_unlock(&mutex_gestionnaires_signaux_atomique) != 0) |
{ |
{ |
pthread_mutex_lock(&((*s_etat_processus).mutex_fork)); |
sem_wait(&((*s_etat_processus).semaphore_fork)); |
BUG(1, uprintf("Unlock error !\n")); |
BUG(1, uprintf("Unlock error !\n")); |
return; |
return; |
} |
} |
|
|
if (pthread_mutex_lock(&((*s_etat_processus).mutex_fork)) != 0) |
if (sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) |
{ |
{ |
BUG(1, uprintf("Unlock error !\n")); |
BUG(1, uprintf("Unlock error !\n")); |
return; |
return; |
Line 2394 envoi_signal_processus(pid_t pid, enum s
|
Line 2394 envoi_signal_processus(pid_t pid, enum s
|
|
|
if (s_queue_signaux == NULL) |
if (s_queue_signaux == NULL) |
{ |
{ |
uprintf("Paf !\n"); |
|
return(1); |
return(1); |
} |
} |
|
|
Line 2430 envoi_signal_processus(pid_t pid, enum s
|
Line 2429 envoi_signal_processus(pid_t pid, enum s
|
// Le signal est envoyé depuis un processus distinct. |
// Le signal est envoyé depuis un processus distinct. |
|
|
# ifdef IPCS_SYSV |
# ifdef IPCS_SYSV |
if ((nom = nom_segment(racine_segment, getpid())) == NULL) |
if ((nom = nom_segment(racine_segment, pid)) == NULL) |
{ |
{ |
return(1); |
return(1); |
} |
} |
Line 2549 envoi_signal_processus(pid_t pid, enum s
|
Line 2548 envoi_signal_processus(pid_t pid, enum s
|
return(1); |
return(1); |
} |
} |
# endif |
# endif |
|
|
close(segment); |
|
} |
} |
|
|
return(0); |
return(0); |
Line 2734 creation_queue_signaux(struct_processus
|
Line 2731 creation_queue_signaux(struct_processus
|
return; |
return; |
} |
} |
|
|
if ((support = open(nom, O_RDWR | O_CREAT | O_EXCL | |
if ((support = open(nom, O_RDWR | O_CREAT | O_EXCL, |
S_IRUSR | S_IWUSR)) == -1) |
S_IRUSR | S_IWUSR)) == -1) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |
(*s_etat_processus).erreur_systeme = d_es_erreur_fichier; |