*corection de la fonction msgSpaceListUnlock

This commit is contained in:
rivka_zan 2004-02-23 16:02:25 +00:00 committed by Glenn Y. Rolland
parent 1007ca56c6
commit a1c27d5b98

View file

@ -16,13 +16,19 @@ int msgSpaceListLock(){
return -1;
}
/*Pose d'un semafore et bloque*/
/*Pose d'un semaphore et le verrouille*/
if(sem_wait(spacesListSemFd)==-1){
NZG_ERROR("sem_wait",spacesListSemId);
return -1;
}
return 0;
/* Ferme le semaphore*/
if(sem_close(spacesListSemFd)==-1){
NZG_ERROR("sem_close",spacesListSemId);
return -1;
}
return 0;
}
@ -31,16 +37,28 @@ 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;
}
/*Relachement du semaphore*/
if(sem_post(spacesListSemFd)==-1){
NZG_ERROR("sem_relache",spacesListSemId);
return -1;
}
/* Ferme le semaphore*/
if(sem_close(spacesListSemFd)==-1){
NZG_ERROR("sem_close",spacesListSemId);
return -1;
}
/*semaphore non bloquant*/
if (sem_trywait(spacesListSemFd)==-1){
NZG_ERROR("sem_trywait",spacesListSemId);
return -1;
}
return 0;
};