l3.libnazgul/src/get.c

30 lines
728 B
C
Raw Normal View History

2004-02-24 10:25:19 +00:00
#include "libnazgul.h"
#define NONBLOCK -1
void * msgGet(msgSpace * space,int queueIndex,int option){
void * resultAddr;
// on teste la possibilit<69> de lecture sur la liste...
if (option == NONBLOCK){
if (msgQueueReadTryLock(space->externId,queueIndex) <0){
NZG_ERROR("msgQueueReadTryLock",space->externId);
goto ERROR;
}
} else {
if (msgQueueReadLock(space->externId,queueIndex) <0){
NZG_ERROR("msgQueueReadLock",space->externId);
goto ERROR;
}
}
// la lecture est possible
// on essaye donc de modifier la liste
msgQueueProtLock(space->externId,queueIndex);
// on a fini de modifier la liste
msgQueueProtUnlock(space->externId,queueIndex);
return resultAddr;
ERROR:
return NULL;
}