*** empty log message ***
This commit is contained in:
parent
f10c429110
commit
a82a3e92a2
1 changed files with 17 additions and 6 deletions
|
@ -1,14 +1,25 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
|
|
||||||
int queueLock(msgSpaceId spaceid,int queueIdx){
|
int queueLock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
|
||||||
queueSemFd=sem_open(queueSemId,O_CREAT|O_EXCL,0666,1);
|
msgQueueSemIdIntern(queueSemId,externId);
|
||||||
|
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);
|
||||||
return -1;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
|
if(sem_wait(queueSemFd)==-1){
|
||||||
|
NZG_ERROR("sem_wait",queueSemId);
|
||||||
|
goto ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
sem_close(queueSemFd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
ERROR:
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue