l3.libnazgul/src/poolDataTabLock.c

29 lines
482 B
C
Raw Normal View History

2004-02-23 23:25:11 +00:00
#include "libnazgul.h"
#include "ids.h"
int msgPoolDataTabLock(msgSpace * space){
sem_t * poolDataTabSemFd;
poolDataTabSemFd=sem_open(
space->poolDataTabSemId
,O_CREAT,
SEM_DEFAULT_MODE,
1);
if(poolDataTabSemFd==SEM_FAILED){
NZG_ERROR("sem_open",space->poolDataTabSemId);
goto ERROR;
}
if(sem_wait(poolDataTabSemFd)==-1){
NZG_ERROR("sem_wait",space->poolDataTabSemId);
goto ERROR;
}
sem_close(poolDataTabSemFd);
return 0;
ERROR:
return -1;
}