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