*modification des fiction locke t unlock

This commit is contained in:
rivka_zan 2004-02-23 20:23:23 +00:00 committed by Glenn Y. Rolland
parent c74c51510a
commit f8bcc4c6f5

View file

@ -13,22 +13,25 @@ int msgSpaceListLock(){
spacesListSemFd=sem_open(spacesListSemId,O_CREAT|O_EXCL,0666,1024);
if(spacesListSemFd==SEM_FAILED){
NZG_ERROR("sem_open",spacesListSemId);
return -1;
goto ERROR;
}
/*Pose d'un semaphore et le verrouille*/
if(sem_wait(spacesListSemFd)==-1){
NZG_ERROR("sem_wait",spacesListSemId);
return -1;
goto ERROR;
}
/* Ferme le semaphore*/
if(sem_close(spacesListSemFd)==-1){
/* if(sem_close(spacesListSemFd)==-1){
NZG_ERROR("sem_close",spacesListSemId);
return -1;
}
}*/
sem_close(spacesListSemFd);
return 0;
ERROR:
return -1;
}
@ -36,29 +39,30 @@ int msgSpaceListLock(){
int msgSpaceListUnlock(){
sem_t * spacesListSemFd;
msgSpaceListSemId spacesListSemId;
/*Ouverture dun semaphore*/
spacesListSemFd=sem_open(spacesListSemId,O_CREAT|O_EXCL,0666,1024);
if(spacesListSemFd==SEM_FAILED){
NZG_ERROR("sem_open",spacesListSemId);
return -1;
goto ERROR;
}
/*Relachement du semaphore*/
if(sem_post(spacesListSemFd)==-1){
NZG_ERROR("sem_relache",spacesListSemId);
return -1;
goto ERROR;
}
/* Ferme le semaphore*/
if(sem_close(spacesListSemFd)==-1){
NZG_ERROR("sem_close",spacesListSemId);
return -1;
}
/* Ferme le semaphore
if(sem_close(spacesListSemFd)==-1){
NZG_ERROR("sem_close",spacesListSemId);
return -1;
}*/
return 0;
ERROR:
return -1;
};