version 1.69, 2011/09/15 17:51:43
|
version 1.79, 2011/11/18 21:03:24
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.3 |
RPL/2 (R) version 4.1.4 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
Line 817 instruction_detach(struct_processus *s_e
|
Line 817 instruction_detach(struct_processus *s_e
|
int pipe_initialisation_segment_signaux[2]; |
int pipe_initialisation_segment_signaux[2]; |
|
|
logical1 drapeau; |
logical1 drapeau; |
logical1 variable_partagee; |
|
|
|
pid_t ppid; |
pid_t ppid; |
pid_t pid_final; |
pid_t pid_final; |
Line 856 instruction_detach(struct_processus *s_e
|
Line 855 instruction_detach(struct_processus *s_e
|
|
|
unsigned long i; |
unsigned long i; |
|
|
|
volatile logical1 variable_partagee; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
attente.tv_sec = 0; |
attente.tv_sec = 0; |
Line 1231 instruction_detach(struct_processus *s_e
|
Line 1232 instruction_detach(struct_processus *s_e
|
return; |
return; |
} |
} |
|
|
# ifndef OS2 |
# ifdef SCHED_OTHER |
# ifndef Cygwin |
|
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_EXPLICIT_SCHED |
if (pthread_attr_setinheritsched(&attributs, |
if (pthread_attr_setinheritsched(&attributs, |
PTHREAD_EXPLICIT_SCHED) != 0) |
PTHREAD_EXPLICIT_SCHED) != 0) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_processus; |
(*s_etat_processus).erreur_systeme = d_es_processus; |
return; |
return; |
} |
} |
|
# endif |
|
|
|
# ifdef PTHREAD_SCOPE_SYSTEM |
if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) |
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 |
# endif |
# endif |
|
|
|
(*s_argument_thread).s_etat_processus = s_etat_processus; |
(*s_argument_thread).s_etat_processus = s_etat_processus; |
|
|
Line 1277 instruction_detach(struct_processus *s_e
|
Line 1280 instruction_detach(struct_processus *s_e
|
|
|
liberation_queue_signaux(s_etat_processus); |
liberation_queue_signaux(s_etat_processus); |
creation_queue_signaux(s_etat_processus); |
creation_queue_signaux(s_etat_processus); |
|
routine_recursive = 0; |
|
|
(*s_etat_processus).pointeur_signal_lecture = 0; |
(*s_etat_processus).pointeur_signal_lecture = 0; |
(*s_etat_processus).pointeur_signal_ecriture = 0; |
(*s_etat_processus).pointeur_signal_ecriture = 0; |
Line 1995 instruction_detach(struct_processus *s_e
|
Line 1999 instruction_detach(struct_processus *s_e
|
} |
} |
else |
else |
{ |
{ |
if ((*s_etat_processus).at_exit != NULL) |
if (((*s_etat_processus).var_volatile_alarme == 0) |
|
&& ((*s_etat_processus).arret_depuis_abort == 0) |
|
&& ((*s_etat_processus).at_exit != NULL)) |
{ |
{ |
(*s_etat_processus).var_volatile_requete_arret = 0; |
(*s_etat_processus).var_volatile_requete_arret = 0; |
|
|
Line 2768 instruction_detach(struct_processus *s_e
|
Line 2774 instruction_detach(struct_processus *s_e
|
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
pthread_mutex_destroy(&((*s_etat_processus).mutex_allocation)); |
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |
pthread_mutex_destroy(&((*s_etat_processus).protection_liste_mutexes)); |
|
|
pthread_mutex_unlock(&((*s_etat_processus).mutex_fork)); |
# ifndef SEMAPHORES_NOMMES |
pthread_mutex_destroy(&((*s_etat_processus).mutex_fork)); |
sem_post(&((*s_etat_processus).semaphore_fork)); |
|
sem_destroy(&((*s_etat_processus).semaphore_fork)); |
|
# else |
|
sem_post((*s_etat_processus).semaphore_fork); |
|
sem_destroy3((*s_etat_processus).semaphore_fork, getpid(), |
|
pthread_self(), SEM_FORK); |
|
# endif |
|
|
free((*s_etat_processus).localisation); |
free((*s_etat_processus).localisation); |
free(s_argument_thread); |
free(s_argument_thread); |
Line 2874 instruction_detach(struct_processus *s_e
|
Line 2886 instruction_detach(struct_processus *s_e
|
close(pipe_initialisation_segment_signaux[0]); |
close(pipe_initialisation_segment_signaux[0]); |
close(pipe_initialisation_segment_signaux[1]); |
close(pipe_initialisation_segment_signaux[1]); |
|
|
// Être sûr que le processus fils soit déjà présent... |
|
|
|
attente.tv_sec = 0; |
|
attente.tv_nsec = GRANULARITE_us * 1000; |
|
|
|
while(envoi_signal_processus((*s_argument_thread).pid, rpl_signull) != 0) |
|
{ |
|
if (errno != ENOENT) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_processus; |
|
pthread_mutex_unlock(&((*s_etat_processus).mutex)); |
|
return; |
|
} |
|
|
|
scrutation_interruptions(s_etat_processus); |
|
nanosleep(&attente, NULL); |
|
INCR_GRANULARITE(attente.tv_nsec); |
|
} |
|
|
|
// Le fils peut être présent sans être en attente du signal de départ. |
// Le fils peut être présent sans être en attente du signal de départ. |
|
|
if (envoi_signal_processus((*s_argument_thread).pid, rpl_sigstart) != 0) |
if (envoi_signal_processus((*s_argument_thread).pid, rpl_sigstart) != 0) |