*** empty log message ***

This commit is contained in:
glenux 2004-02-25 11:22:38 +00:00
parent 52e7fa02fc
commit a96c647b0b
2 changed files with 20 additions and 33 deletions

View file

@ -6,25 +6,20 @@ int msgFree(msgSpace * space, void * addr){
int poolIndex; int poolIndex;
int bufferIndex; int bufferIndex;
msgPoolData * poolDataTabAddr; msgPoolData * poolDataTabAddr;
sem_t * poolDataTabSemFd;
msgPoolDataTabSemId ressourceSemId;
sem_t * ressourceSemFd; sem_t * ressourceSemFd;
/* on acquiert le droit de modifier les infos sur la ressource */ msgPoolDataTabSemId ressourceSemId;
/* on acquiert le droit de modifier les infos sur la ressource */
/* on protege le tableau des associations */ /* on protege le tableau des associations */
poolDataTabSemFd=sem_open(space->poolDataTabSemId, if (msgPoolDataTabLock(space) <0){
O_CREAT,SEM_DEFAULT_MODE,1); NZG_ERROR("msgPoolDataTabLock",space->poolDataTabSemId);
if (poolDataTabSemFd == SEM_FAILED){ goto ERROR;
NZG_ERROR("sem_open : ouverture de la ressource", };
space->poolDataTabSemId);
return -1;
}
sem_wait(poolDataTabSemFd);
/* verifier le premier arg du shm_open */ /* verifier le premier arg du shm_open */
poolDataTabAddr = msgPoolDataTabOpen(space); poolDataTabAddr = msgPoolDataTabOpen(space);
// TODO: verouiller semaphore DataInfo // TODO: verouiller semaphore DataInfo ??
int err; int err;
poolIndex=-1; bufferIndex=-1; poolIndex=-1; bufferIndex=-1;
@ -51,8 +46,6 @@ sem_t * poolDataTabSemFd;
// deverouiller semaphore DataInfo // deverouiller semaphore DataInfo
msgPoolDataTabUnlock(space); msgPoolDataTabUnlock(space);
// sem_post(poolDataTabSemFd);
// sem_close(poolDataTabSemFd);
// deverouiller semaphore ressource. // deverouiller semaphore ressource.
msgPoolSemIdIntern(ressourceSemId,space->id,poolIndex); msgPoolSemIdIntern(ressourceSemId,space->id,poolIndex);

View file

@ -26,24 +26,18 @@ int main(void) {
} }
printf("CREATION ------------------ ok\n"); printf("CREATION ------------------ ok\n");
sleep(1);
pid_t pid=fork(); mSPAC=msgSpaceOpen(testId);
montext=msgAllocate(mSPAC,2,280,0);
if (pid ==0){ *montext=42;
mSPAC=msgSpaceOpen(testId); printf("### test Valeur0 %d ###\n",(int)*montext);
sleep(2); printf("Put..."); fflush(stdout);
printf("Get..."); fflush(stdout); msgPut(mSPAC,0,montext);
montext=msgGet(mSPAC,0,0); printf("put-ok\n");
printf("get-ok\n");
} else {
mSPAC=msgSpaceOpen(testId); printf("Get..."); fflush(stdout);
montext=msgAllocate(mSPAC,2,280,0); montext=msgGet(mSPAC,0,0);
*montext=42; printf("get-ok\n");
printf("### test Valeur0 %d ###\n",(int)*montext);
printf("Put..."); fflush(stdout);
msgPut(mSPAC,0,montext);
printf("put-ok\n");
//sleep(2);
}
return 0; return 0;
} }