--- rpl/src/instructions_s10.c 2011/09/20 09:51:43 1.47 +++ rpl/src/instructions_s10.c 2011/12/16 13:46:56 1.52 @@ -1,6 +1,6 @@ /* ================================================================================ - RPL/2 (R) version 4.1.3 + RPL/2 (R) version 4.1.5 Copyright (C) 1989-2011 Dr. BERTRAND Joël This file is part of RPL/2. @@ -45,7 +45,6 @@ instruction_spawn(struct_processus *s_et pthread_mutexattr_t attributs_mutex; - pthread_t thread_id; pthread_t thread_surveillance; struct_descripteur_thread *s_argument_thread; @@ -353,27 +352,29 @@ instruction_spawn(struct_processus *s_et return; } -# ifndef OS2 -# ifndef Cygwin +# ifdef SCHED_OTHER if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_EXPLICIT_SCHED if (pthread_attr_setinheritsched(&attributs, PTHREAD_EXPLICIT_SCHED) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_SCOPE_SYSTEM if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } # endif -# endif /* * Création de l'objet à retourner @@ -413,8 +414,8 @@ instruction_spawn(struct_processus *s_et (*s_argument_thread).thread_actif = d_faux; - if (pthread_create(&thread_id, &attributs, lancement_thread, - s_argument_thread) != 0) + if (pthread_create(&(*s_nouvel_etat_processus).tid, + &attributs, lancement_thread, s_argument_thread) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -449,28 +450,30 @@ instruction_spawn(struct_processus *s_et return; } -# ifndef OS2 -# ifndef Cygwin +# ifdef SCHED_OTHER if (pthread_attr_setschedpolicy(&attributs, SCHED_OTHER) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_EXPLICIT_SCHED if (pthread_attr_setinheritsched(&attributs, PTHREAD_EXPLICIT_SCHED) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } +# endif +# ifdef PTHREAD_SCOPE_SYSTEM if (pthread_attr_setscope(&attributs, PTHREAD_SCOPE_SYSTEM) != 0) { (*s_etat_processus).erreur_systeme = d_es_processus; return; } # endif -# endif /* * On copie l'objet plutôt que le pointeur car cet objet peut être @@ -1105,7 +1108,11 @@ instruction_smphrdecr(struct_processus * } } - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) +# ifndef SEMAPHORES_NOMMES + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) +# else + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { (*s_etat_processus).erreur_systeme = d_es_processus; return; @@ -1116,7 +1123,12 @@ instruction_smphrdecr(struct_processus * { if (errno != EINTR) { - sem_post(&((*s_etat_processus).semaphore_fork)); +# ifndef SEMAPHORES_NOMMES + sem_post(&((*s_etat_processus).semaphore_fork)); +# else + sem_post((*s_etat_processus).semaphore_fork); +# endif + (*s_etat_processus).erreur_execution = d_ex_semaphore; if ((*s_etat_processus).profilage == d_vrai) @@ -1129,7 +1141,11 @@ instruction_smphrdecr(struct_processus * } } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) +# ifndef SEMAPHORES_NOMMES + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) +# else + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) +# endif { if (errno != EINTR) { @@ -1248,7 +1264,11 @@ instruction_smphrtrydecr(struct_processu } } - if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) +# ifndef SEMAPHORES_NOMMES + if (sem_post(&((*s_etat_processus).semaphore_fork)) != 0) +# else + if (sem_post((*s_etat_processus).semaphore_fork) != 0) +# endif { if ((*s_etat_processus).profilage == d_vrai) { @@ -1297,7 +1317,11 @@ instruction_smphrtrydecr(struct_processu } } - while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) +# ifndef SEMAPHORES_NOMMES + while(sem_wait(&((*s_etat_processus).semaphore_fork)) != 0) +# else + while(sem_wait((*s_etat_processus).semaphore_fork) != 0) +# endif { if (errno != EINTR) {