*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;
}
@ -41,24 +44,25 @@ int msgSpaceListUnlock(){
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*/
/* Ferme le semaphore
if(sem_close(spacesListSemFd)==-1){
NZG_ERROR("sem_close",spacesListSemId);
return -1;
}
}*/
return 0;
ERROR:
return -1;
};