--- rpl/src/instructions_s10.c 2011/03/06 16:44:13 1.29 +++ rpl/src/instructions_s10.c 2011/09/14 14:34:28 1.43 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.0.21 + RPL/2 (R) version 4.1.3 Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -48,9 +48,6 @@ instruction_spawn(struct_processus *s_et pthread_t thread_id; pthread_t thread_surveillance; - sigset_t oldset; - sigset_t set; - struct_descripteur_thread *s_argument_thread; struct_liste_chainee *l_element_courant; @@ -132,9 +129,7 @@ instruction_spawn(struct_processus *s_et if (recherche_variable(s_etat_processus, (*((struct_nom *) (*s_objet).objet)).nom) == d_vrai) { - if ((*s_etat_processus).s_liste_variables - [(*s_etat_processus).position_variable_courante].objet - == NULL) + if ((*(*s_etat_processus).pointeur_variable_courante).objet == NULL) { if (pthread_mutex_lock(&((*(*s_etat_processus) .s_liste_variables_partagees).mutex)) != 0) @@ -144,13 +139,10 @@ instruction_spawn(struct_processus *s_et } if (recherche_variable_partagee(s_etat_processus, - (*s_etat_processus).s_liste_variables - [(*s_etat_processus).position_variable_courante].nom, - (*s_etat_processus).s_liste_variables - [(*s_etat_processus).position_variable_courante] - .variable_partagee, (*s_etat_processus) - .s_liste_variables[(*s_etat_processus) - .position_variable_courante].origine) == d_faux) + (*(*s_etat_processus).pointeur_variable_courante).nom, + (*(*s_etat_processus).pointeur_variable_courante) + .variable_partagee, (*(*s_etat_processus) + .pointeur_variable_courante).origine) == d_faux) { if (pthread_mutex_unlock(&((*(*s_etat_processus) .s_liste_variables_partagees).mutex)) != 0) @@ -219,11 +211,9 @@ instruction_spawn(struct_processus *s_et } else { - if (((*(*s_etat_processus).s_liste_variables - [(*s_etat_processus).position_variable_courante].objet) - .type != RPN) && ((*(*s_etat_processus) - .s_liste_variables[(*s_etat_processus) - .position_variable_courante].objet).type != ADR)) + if (((*(*(*s_etat_processus).pointeur_variable_courante).objet) + .type != RPN) && ((*(*(*s_etat_processus) + .pointeur_variable_courante).objet).type != ADR)) { liberation(s_etat_processus, s_objet); @@ -243,46 +233,6 @@ instruction_spawn(struct_processus *s_et } } - if (sigemptyset(&set) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - - if (sigaddset(&set, SIGSTART) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - - /* - * Le signal SIGFSTOP doit être traité ! - */ - - if (sigaddset(&set, SIGFSTOP) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - - if (sigaddset(&set, SIGFABORT) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - - if (sigaddset(&set, SIGURG) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - - if (pthread_sigmask(SIG_BLOCK, &set, &oldset) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - if ((s_argument_thread = malloc(sizeof(struct_descripteur_thread))) == NULL) { (*s_etat_processus).erreur_systeme = d_es_processus; @@ -404,6 +354,7 @@ instruction_spawn(struct_processus *s_et } # ifndef OS2 +# ifndef Cygwin if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; @@ -422,6 +373,7 @@ instruction_spawn(struct_processus *s_et return; } # endif +# endif /* * Création de l'objet à retourner @@ -465,8 +417,6 @@ instruction_spawn(struct_processus *s_et (*s_argument_thread).destruction_objet = d_faux; } - (*s_argument_thread).set = set; - (*s_argument_thread).oldset = oldset; (*s_argument_thread).thread_actif = d_faux; if (pthread_create(&thread_id, &attributs, lancement_thread, @@ -505,6 +455,7 @@ instruction_spawn(struct_processus *s_et } # ifndef OS2 +# ifndef Cygwin if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; @@ -524,6 +475,7 @@ instruction_spawn(struct_processus *s_et return; } # endif +# endif // Attente de l'affectation de la grandeur processus.tid par le thread fils. @@ -683,20 +635,12 @@ instruction_spawn(struct_processus *s_et // Le fils peut être présent sans être en attente du signal de départ. - if (pthread_kill((*s_argument_thread).tid, SIGSTART) != 0) - { - (*s_etat_processus).erreur_systeme = d_es_processus; - return; - } - - if (pthread_sigmask(SIG_SETMASK, &oldset, NULL) != 0) + if (envoi_signal_thread((*s_argument_thread).tid, rpl_sigstart) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } - sigpending(&set); - return; }