* ajout du debug mode (affichage de certains messages seulement lors du debug)
This commit is contained in:
parent
a6a69bb22f
commit
eff2be3efa
8 changed files with 38 additions and 32 deletions
|
@ -1,9 +1,11 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
|
||||||
int msgPoolDataTabLock(msgSpace * space){
|
int msgPoolDataTabLock(msgSpace * space){
|
||||||
sem_t * poolDataTabSemFd;
|
sem_t * poolDataTabSemFd;
|
||||||
printf("Locking %s\n",space->poolDataTabSemId);
|
if (DEBUG) {printf("Locking %s\n",space->poolDataTabSemId);}
|
||||||
|
|
||||||
poolDataTabSemFd=sem_open(
|
poolDataTabSemFd=sem_open(
|
||||||
space->poolDataTabSemId
|
space->poolDataTabSemId
|
||||||
|
@ -21,7 +23,7 @@ printf("Locking %s\n",space->poolDataTabSemId);
|
||||||
}
|
}
|
||||||
int semval=0;
|
int semval=0;
|
||||||
sem_getvalue(poolDataTabSemFd,&semval);
|
sem_getvalue(poolDataTabSemFd,&semval);
|
||||||
printf("(AfternValue:%d)\n",semval);
|
if (DEBUG) { printf("(AfternValue:%d)\n",semval);}
|
||||||
|
|
||||||
sem_close(poolDataTabSemFd);
|
sem_close(poolDataTabSemFd);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
|
||||||
int msgPoolDataTabUnlock(msgSpace * space){
|
int msgPoolDataTabUnlock(msgSpace * space){
|
||||||
sem_t * poolDataTabSemFd;
|
sem_t * poolDataTabSemFd;
|
||||||
printf("Unlocking %s\n",space->poolDataTabSemId);
|
if (DEBUG) { printf("Unlocking %s\n",space->poolDataTabSemId); }
|
||||||
poolDataTabSemFd=sem_open(
|
poolDataTabSemFd=sem_open(
|
||||||
space->poolDataTabSemId
|
space->poolDataTabSemId
|
||||||
,O_CREAT,
|
,O_CREAT,
|
||||||
SEM_DEFAULT_MODE,
|
SEM_DEFAULT_MODE,
|
||||||
|
@ -19,9 +20,9 @@ printf("Unlocking %s\n",space->poolDataTabSemId);
|
||||||
NZG_ERROR("sem_post",space->poolDataTabSemId);
|
NZG_ERROR("sem_post",space->poolDataTabSemId);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
int semval=0;
|
int semval=0;
|
||||||
sem_getvalue(poolDataTabSemFd,&semval);
|
sem_getvalue(poolDataTabSemFd,&semval);
|
||||||
printf("(AfternValue:%d)\n",semval);
|
if (DEBUG) { printf("(AfternValue:%d)\n",semval); }
|
||||||
|
|
||||||
sem_close(poolDataTabSemFd);
|
sem_close(poolDataTabSemFd);
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
int msgQueueProtLock(msgSpaceId externId,int queueIdx){
|
int msgQueueProtLock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
|
||||||
msgQueueProtSemIdIntern(queueSemId,externId,queueIdx);
|
msgQueueProtSemIdIntern(queueSemId,externId,queueIdx);
|
||||||
printf("Locking %s\n",queueSemId);
|
if (DEBUG) { printf("Locking %s\n",queueSemId);}
|
||||||
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
||||||
if(queueSemFd==SEM_FAILED){
|
if(queueSemFd==SEM_FAILED){
|
||||||
NZG_ERROR("sem_open",queueSemId);
|
NZG_ERROR("sem_open",queueSemId);
|
||||||
|
@ -19,7 +20,7 @@ int msgQueueProtLock(msgSpaceId externId,int queueIdx){
|
||||||
}
|
}
|
||||||
int semval=0;
|
int semval=0;
|
||||||
sem_getvalue(queueSemFd,&semval);
|
sem_getvalue(queueSemFd,&semval);
|
||||||
printf("(AfterValue:%d)\n",semval);
|
if (DEBUG) { printf("(AfterValue:%d)\n",semval); }
|
||||||
|
|
||||||
sem_close(queueSemFd);
|
sem_close(queueSemFd);
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
|
||||||
int msgQueueProtUnlock(msgSpaceId externId,int queueIdx){
|
int msgQueueProtUnlock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
|
||||||
msgQueueProtSemIdIntern(queueSemId,externId,queueIdx);
|
msgQueueProtSemIdIntern(queueSemId,externId,queueIdx);
|
||||||
printf("Unlocking %s\n",queueSemId);
|
if (DEBUG) { printf("Unlocking %s\n",queueSemId); }
|
||||||
|
|
||||||
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
||||||
if(queueSemFd==SEM_FAILED){
|
if(queueSemFd==SEM_FAILED){
|
||||||
NZG_ERROR("sem_open",queueSemId);
|
NZG_ERROR("sem_open",queueSemId);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
|
@ -18,9 +20,9 @@ int msgQueueProtUnlock(msgSpaceId externId,int queueIdx){
|
||||||
NZG_ERROR("sem_post",queueSemId);
|
NZG_ERROR("sem_post",queueSemId);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
int semval=0;
|
int semval=0;
|
||||||
sem_getvalue(queueSemFd,&semval);
|
sem_getvalue(queueSemFd,&semval);
|
||||||
printf("(AfterValue:%d)\n",semval);
|
if (DEBUG) { printf("(AfterValue:%d)\n",semval); }
|
||||||
|
|
||||||
sem_close(queueSemFd);
|
sem_close(queueSemFd);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
|
||||||
int msgQueueReadLock(msgSpaceId externId,int queueIdx){
|
int msgQueueReadLock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
|
||||||
msgQueueReadSemIdIntern(queueSemId,externId,queueIdx);
|
msgQueueReadSemIdIntern(queueSemId,externId,queueIdx);
|
||||||
printf("Locking %s\n",queueSemId);
|
if (DEBUG) { printf("Locking %s\n",queueSemId); }
|
||||||
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
||||||
if(queueSemFd==SEM_FAILED){
|
if(queueSemFd==SEM_FAILED){
|
||||||
NZG_ERROR("sem_open",queueSemId);
|
NZG_ERROR("sem_open",queueSemId);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
|
@ -18,11 +20,8 @@ int msgQueueReadLock(msgSpaceId externId,int queueIdx){
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
int semval=0;
|
int semval=0;
|
||||||
sem_getvalue(queueSemFd,&semval);
|
sem_getvalue(queueSemFd,&semval);
|
||||||
printf("(AfterValue:%d)\n",semval);
|
if (DEBUG) { printf("(AfterValue:%d)\n",semval); }
|
||||||
|
|
||||||
sem_close(queueSemFd);
|
|
||||||
|
|
||||||
|
|
||||||
sem_close(queueSemFd);
|
sem_close(queueSemFd);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
|
||||||
int msgQueueReadTryLock(msgSpaceId externId,int queueIdx){
|
int msgQueueReadTryLock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
@ -16,13 +18,10 @@ int msgQueueReadTryLock(msgSpaceId externId,int queueIdx){
|
||||||
NZG_ERROR("sem_wait",queueSemId);
|
NZG_ERROR("sem_wait",queueSemId);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
printf("Locking %s\n",queueSemId);
|
if (DEBUG) { printf("Locking %s\n",queueSemId); }
|
||||||
int semval=0;
|
int semval=0;
|
||||||
sem_getvalue(queueSemFd,&semval);
|
sem_getvalue(queueSemFd,&semval);
|
||||||
printf("(AfterValue:%d)\n",semval);
|
if (DEBUG) { printf("(AfterValue:%d)\n",semval); }
|
||||||
|
|
||||||
sem_close(queueSemFd);
|
|
||||||
|
|
||||||
|
|
||||||
sem_close(queueSemFd);
|
sem_close(queueSemFd);
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
#include "libnazgul.h"
|
#include "libnazgul.h"
|
||||||
#include "ids.h"
|
#include "ids.h"
|
||||||
|
|
||||||
|
#define DEBUG 0
|
||||||
|
|
||||||
int msgQueueReadUnlock(msgSpaceId externId,int queueIdx){
|
int msgQueueReadUnlock(msgSpaceId externId,int queueIdx){
|
||||||
sem_t * queueSemFd;
|
sem_t * queueSemFd;
|
||||||
msgQueueSemId queueSemId;
|
msgQueueSemId queueSemId;
|
||||||
|
|
||||||
msgQueueReadSemIdIntern(queueSemId,externId,queueIdx);
|
msgQueueReadSemIdIntern(queueSemId,externId,queueIdx);
|
||||||
printf("Unlocking %s\n",queueSemId);
|
if (DEBUG) { printf("Unlocking %s\n",queueSemId); }
|
||||||
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
queueSemFd=sem_open(queueSemId,O_CREAT,SEM_DEFAULT_MODE,1);
|
||||||
if(queueSemFd==SEM_FAILED){
|
if(queueSemFd==SEM_FAILED){
|
||||||
NZG_ERROR("sem_open",queueSemId);
|
NZG_ERROR("sem_open",queueSemId);
|
||||||
|
@ -19,7 +21,7 @@ int msgQueueReadUnlock(msgSpaceId externId,int queueIdx){
|
||||||
}
|
}
|
||||||
int semval=0;
|
int semval=0;
|
||||||
sem_getvalue(queueSemFd,&semval);
|
sem_getvalue(queueSemFd,&semval);
|
||||||
printf("(AfterValue:%d)\n",semval);
|
if (DEBUG) { printf("(AfterValue:%d)\n",semval); }
|
||||||
|
|
||||||
|
|
||||||
sem_close(queueSemFd);
|
sem_close(queueSemFd);
|
||||||
|
|
|
@ -38,8 +38,7 @@ int about(char * spaceId){
|
||||||
NZG_ERROR("sem_getvalue",ressourceSemId);
|
NZG_ERROR("sem_getvalue",ressourceSemId);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
}
|
}
|
||||||
//msgPoolDataTabLock(space);
|
msgPoolDataTabLock(space);
|
||||||
//msgPoolDataTabUnlock(space);
|
|
||||||
poolDataTab= msgPoolDataTabOpen(space);
|
poolDataTab= msgPoolDataTabOpen(space);
|
||||||
// donner le nombre de buffer disponibles
|
// donner le nombre de buffer disponibles
|
||||||
printf("- %d/%d free buffers in pool #%d\n",
|
printf("- %d/%d free buffers in pool #%d\n",
|
||||||
|
@ -47,6 +46,7 @@ int about(char * spaceId){
|
||||||
poolDataTab[i].bufferNb,
|
poolDataTab[i].bufferNb,
|
||||||
i);
|
i);
|
||||||
msgPoolDataTabClose(space,poolDataTab);
|
msgPoolDataTabClose(space,poolDataTab);
|
||||||
|
msgPoolDataTabUnlock(space);
|
||||||
if(sem_close(ressourceSemFd) <0){
|
if(sem_close(ressourceSemFd) <0){
|
||||||
NZG_ERROR("sem_getvalue",ressourceSemId);
|
NZG_ERROR("sem_getvalue",ressourceSemId);
|
||||||
goto ERROR;
|
goto ERROR;
|
||||||
|
|
Loading…
Reference in a new issue