From 764eaa5e21e1be5701049afb725cbbe2377377d5 Mon Sep 17 00:00:00 2001 From: glenux Date: Mon, 23 Feb 2004 20:00:06 +0000 Subject: [PATCH] *** empty log message *** --- src/queueLock.c | 3 ++- src/queueUnlock.c | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/queueLock.c b/src/queueLock.c index 2c18bfe..393909f 100644 --- a/src/queueLock.c +++ b/src/queueLock.c @@ -1,10 +1,11 @@ #include "libnazgul.h" +#include "ids.h" int queueLock(msgSpaceId externId,int queueIdx){ sem_t * queueSemFd; msgQueueSemId queueSemId; - msgQueueSemIdIntern(queueSemId,externId); + msgQueueSemIdIntern(queueSemId,externId,queueIdx); queueSemFd=sem_open(queueSemId,O_CREAT|O_EXCL,SEM_DEFAULT_MODE,1); if(queueSemFd==SEM_FAILED){ NZG_ERROR("sem_open",queueSemId); diff --git a/src/queueUnlock.c b/src/queueUnlock.c index 46f702d..0306195 100644 --- a/src/queueUnlock.c +++ b/src/queueUnlock.c @@ -1,5 +1,26 @@ #include "libnazgul.h" +#include "ids.h" -int queueUnlock(msgSpaceId spaceid,int queueIdx){ +int queueUnlock(msgSpaceId externId,int queueIdx){ + sem_t * queueSemFd; + msgQueueSemId queueSemId; + + msgQueueSemIdIntern(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; } +