l3.libnazgul/test/put_get_mono.c

46 lines
1,017 B
C
Raw Normal View History

2004-02-25 09:10:13 +00:00
#include <wait.h>
#include "libnazgul.h"
int main(void) {
// msgSpace mS=0;
msgSpaceId testId;
msgSpace * mSPAC;
msgPool poolInfos[3];
char * montext;
poolInfos[0].bufferNb=4;
poolInfos[0].bufferSize=200;
poolInfos[1].bufferNb=5;
poolInfos[1].bufferSize=250;
sprintf(testId,"test%d",(int)getuid());
printf("RequestedId: %s\n",testId);
printf("Void size: %d\n",sizeof(void));
//creation de l'espace de messages
mSPAC=msgSpaceCreate(testId,1,2,poolInfos);
2004-02-25 10:32:41 +00:00
if (mSPAC ==NULL) {
NZG_ERROR("msgSpaceCreate",testId);
exit(0);
}
printf("CREATION ------------------ ok\n");
2004-02-25 11:22:38 +00:00
mSPAC=msgSpaceOpen(testId);
2004-02-25 11:34:49 +00:00
montext=msgAllocate(mSPAC,1,280,0);
2004-02-25 11:22:38 +00:00
*montext=42;
printf("### test Valeur0 %d ###\n",(int)*montext);
printf("Put..."); fflush(stdout);
msgPut(mSPAC,0,montext);
printf("put-ok\n");
printf("Get..."); fflush(stdout);
montext=msgGet(mSPAC,0,0);
printf("get-ok\n");
2004-02-25 12:00:13 +00:00
printf("### test Reception %d ###\n",(int)*montext);
2004-02-26 08:11:00 +00:00
msgSpaceDelete(testId);
2004-02-25 09:10:13 +00:00
return 0;
}