version 1.72, 2011/09/21 09:09:22
|
version 1.80, 2012/04/03 21:27:09
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.3 |
RPL/2 (R) version 4.1.7 |
Copyright (C) 1989-2011 Dr. BERTRAND Joël |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 544 allocation(struct_processus *s_etat_proc
|
Line 544 allocation(struct_processus *s_etat_proc
|
return(NULL); |
return(NULL); |
} |
} |
|
|
|
(*((struct_mutex *) (*s_objet).objet)).tid = pthread_self(); |
break; |
break; |
} |
} |
|
|
Line 1103 liberation(struct_processus *s_etat_proc
|
Line 1104 liberation(struct_processus *s_etat_proc
|
return; |
return; |
} |
} |
|
|
|
if (pthread_mutex_trylock(&((*((struct_mutex *) |
|
(*s_objet).objet)).mutex)) == 0) |
|
{ |
|
// On a pu verrouiller le mutex. Il faut donc spécifier le tid. |
|
(*((struct_mutex *) (*s_objet).objet)).tid = pthread_self(); |
|
} |
|
|
|
if (pthread_equal(pthread_self(), |
|
(*((struct_mutex *) (*s_objet).objet)).tid) != 0) |
|
{ |
|
pthread_mutex_unlock(&((*((struct_mutex *) |
|
(*s_objet).objet)).mutex)); |
|
} |
|
else |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_mutex_acquis_autre_thread; |
|
return; |
|
} |
|
|
|
pthread_mutex_destroy(&((*((struct_mutex *) |
|
(*s_objet).objet)).mutex)); |
free((struct_mutex *) (*s_objet).objet); |
free((struct_mutex *) (*s_objet).objet); |
break; |
break; |
} |
} |
Line 2216 copie_objet(struct_processus *s_etat_pro
|
Line 2239 copie_objet(struct_processus *s_etat_pro
|
|
|
case MTX : |
case MTX : |
{ |
{ |
if (type != 'O') |
// La duplication d'un mutex renvoie le même objet. |
{ |
incrementation_atomique(s_objet); |
incrementation_atomique(s_objet); |
return(s_objet); |
return(s_objet); |
|
} |
|
|
|
if ((s_nouvel_objet = allocation(s_etat_processus, MTX)) == NULL) |
|
{ |
|
return(NULL); |
|
} |
|
|
|
(*((struct_mutex *) ((*s_nouvel_objet).objet))).mutex = |
|
(*((struct_mutex *) ((*s_objet).objet))).mutex; |
|
break; |
|
} |
} |
|
|
case NOM : |
case NOM : |
Line 2484 copie_objet(struct_processus *s_etat_pro
|
Line 2496 copie_objet(struct_processus *s_etat_pro
|
return(NULL); |
return(NULL); |
} |
} |
|
|
|
(*((struct_semaphore *) (*s_nouvel_objet).objet)).semaphore = |
|
(*((struct_semaphore *) (*s_objet).objet)).semaphore; |
strcpy((*((struct_semaphore *) (*s_nouvel_objet).objet)).nom, |
strcpy((*((struct_semaphore *) (*s_nouvel_objet).objet)).nom, |
(*((struct_semaphore *) (*s_objet).objet)).nom); |
(*((struct_semaphore *) (*s_objet).objet)).nom); |
break; |
break; |