*** empty log message ***

This commit is contained in:
glenux 2004-02-24 11:01:18 +00:00
parent 1f9ef130b8
commit 1e021b0ebf
2 changed files with 33 additions and 4 deletions

View file

@ -4,6 +4,10 @@
void * msgGet(msgSpace * space,int queueIndex,int option){
void * resultAddr;
msgQueueId queueId;
msgQueue * queue;
msgQueueElemId oldElemId;
msgQueueElem * oldElem;
// on teste la possibilité de lecture sur la liste...
if (option == NONBLOCK){
if (msgQueueReadTryLock(space->externId,queueIndex) <0){
@ -19,19 +23,18 @@ void * msgGet(msgSpace * space,int queueIndex,int option){
// la lecture est possible
// on essaye donc de modifier la liste
msgQueueProtLock(space->externId,queueIndex);
msgQueueId queueId;
msgQueue * queue;
msgQueueIdIntern(queueId,space->externId,queueIndex);
// ouvrir la file
queue = msgQueueOpen(queueId);
msgQueueElemId oldElemId;
// recupérer l'id de l'ancien element...
msgQueueRem(queue, oldElemId);
msgQueueElem * oldElem;
oldElem = msgQueueElemOpen(oldElemId);
// mapper le buffer dans l'espace mémoire du processus
// attacher au buffer...
// fermer la file
msgQueueClose(queue);

26
src/queueReadTryLock.c Normal file
View file

@ -0,0 +1,26 @@
#include "libnazgul.h"
#include "ids.h"
int msgQueueReadTryLock(msgSpaceId externId,int queueIdx){
sem_t * queueSemFd;
msgQueueSemId queueSemId;
msgQueueReadSemIdIntern(queueSemId,externId,queueIdx);
queueSemFd=sem_open(queueSemId,O_CREAT|O_EXCL,SEM_DEFAULT_MODE,1);
if(queueSemFd==SEM_FAILED){
NZG_ERROR("sem_open",queueSemId);
goto ERROR;
}
if(sem_trywait(queueSemFd)==-1){
NZG_ERROR("sem_wait",queueSemId);
goto ERROR;
}
sem_close(queueSemFd);
return 0;
ERROR:
return -1;
}