*** empty log message ***
This commit is contained in:
parent
5d1938a5d7
commit
fabaee86c6
5 changed files with 64 additions and 8 deletions
12
src/proto.h
12
src/proto.h
|
@ -61,14 +61,18 @@ int msgQueueElemDelete(msgQueueElemId queueElemId);
|
||||||
void *msgQueueElemOpen(msgQueueElemId queueElemId);
|
void *msgQueueElemOpen(msgQueueElemId queueElemId);
|
||||||
/* queueInit.c */
|
/* queueInit.c */
|
||||||
msgQueue *queueInit(msgSpaceId externId, int queueIdx);
|
msgQueue *queueInit(msgSpaceId externId, int queueIdx);
|
||||||
/* queueLock.c */
|
|
||||||
int queueLock(msgSpaceId externId, int queueIdx);
|
|
||||||
/* queueOpen.c */
|
/* queueOpen.c */
|
||||||
void *msgQueueOpen(msgQueueId queueId);
|
void *msgQueueOpen(msgQueueId queueId);
|
||||||
|
/* queueProtLock.c */
|
||||||
|
int queueProtLock(msgSpaceId externId, int queueIdx);
|
||||||
|
/* queueProtUnlock.c */
|
||||||
|
int queueProtUnlock(msgSpaceId externId, int queueIdx);
|
||||||
|
/* queueReadLock.c */
|
||||||
|
int queueReadLock(msgSpaceId externId, int queueIdx);
|
||||||
|
/* queueReadUnlock.c */
|
||||||
|
int queueReadUnlock(msgSpaceId externId, int queueIdx);
|
||||||
/* queueRem.c */
|
/* queueRem.c */
|
||||||
int msgQueueElemRem(msgQueue *queue, msgQueueElemId oldElemId);
|
int msgQueueElemRem(msgQueue *queue, msgQueueElemId oldElemId);
|
||||||
/* queueUnlock.c */
|
|
||||||
int queueUnlock(msgSpaceId externId, int queueIdx);
|
|
||||||
/* spaceCreate.c */
|
/* spaceCreate.c */
|
||||||
msgSpace *msgSpaceCreate(msgSpaceId externId, int queueNb, int poolNb, msgPool *poolInfos);
|
msgSpace *msgSpaceCreate(msgSpaceId externId, int queueNb, int poolNb, msgPool *poolInfos);
|
||||||
/* spaceDelete.c */
|
/* spaceDelete.c */
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
int queueLock(msgSpaceId externId,int queueIdx){
|
int queueProtLock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
|
||||||
msgQueueSemIdIntern(queueSemId,externId,queueIdx);
|
msgQueueProtSemIdIntern(queueSemId,externId,queueIdx);
|
||||||
queueSemFd=sem_open(queueSemId,O_CREAT|O_EXCL,SEM_DEFAULT_MODE,1);
|
queueSemFd=sem_open(queueSemId,O_CREAT|O_EXCL,SEM_DEFAULT_MODE,1);
|
||||||
if(queueSemFd==SEM_FAILED){
|
if(queueSemFd==SEM_FAILED){
|
||||||
NZG_ERROR("sem_open",queueSemId);
|
NZG_ERROR("sem_open",queueSemId);
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
int queueUnlock(msgSpaceId externId,int queueIdx){
|
int queueProtUnlock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
|
||||||
msgQueueSemIdIntern(queueSemId,externId,queueIdx);
|
msgQueueProtSemIdIntern(queueSemId,externId,queueIdx);
|
||||||
queueSemFd=sem_open(queueSemId,O_CREAT|O_EXCL,SEM_DEFAULT_MODE,1);
|
queueSemFd=sem_open(queueSemId,O_CREAT|O_EXCL,SEM_DEFAULT_MODE,1);
|
||||||
if(queueSemFd==SEM_FAILED){
|
if(queueSemFd==SEM_FAILED){
|
||||||
NZG_ERROR("sem_open",queueSemId);
|
NZG_ERROR("sem_open",queueSemId);
|
||||||
|
|
26
src/queueReadLock.c
Normal file
26
src/queueReadLock.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include "libnazgul.h"
|
||||||
|
#include "ids.h"
|
||||||
|
|
||||||
|
int queueReadLock(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_wait(queueSemFd)==-1){
|
||||||
|
NZG_ERROR("sem_wait",queueSemId);
|
||||||
|
goto ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
sem_close(queueSemFd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
ERROR:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
26
src/queueReadUnlock.c
Normal file
26
src/queueReadUnlock.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#include "libnazgul.h"
|
||||||
|
#include "ids.h"
|
||||||
|
|
||||||
|
int queueReadUnlock(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_post(queueSemFd)==-1){
|
||||||
|
NZG_ERROR("sem_post",queueSemId);
|
||||||
|
goto ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
sem_close(queueSemFd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
ERROR:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue