29 lines
530 B
C
29 lines
530 B
C
#include "libnazgul.h"
|
|
#include "ids.h"
|
|
|
|
int msgPoolDataTabLock(msgSpace * space){
|
|
sem_t * poolDataTabSemFd;
|
|
printf("Locking %s\n",space->poolDataTabSemId);
|
|
|
|
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;
|
|
}
|
|
|