simple makefile to compiler server and client and change name of servertest.c to...
authoradash <adash>
Mon, 19 Mar 2007 02:23:27 +0000 (02:23 +0000)
committeradash <adash>
Mon, 19 Mar 2007 02:23:27 +0000 (02:23 +0000)
Robust/src/Runtime/DSTM/interface/Makefile [new file with mode: 0644]
Robust/src/Runtime/DSTM/interface/testserver.c [new file with mode: 0644]

diff --git a/Robust/src/Runtime/DSTM/interface/Makefile b/Robust/src/Runtime/DSTM/interface/Makefile
new file mode 100644 (file)
index 0000000..a2a65d4
--- /dev/null
@@ -0,0 +1,8 @@
+client:
+       gcc -g -o client trans.c testclient.c mlookup.c clookup.c llookup.c dstm.c objstr.c dstmserver.c 
+
+server:
+       gcc -g -o server dstmserver.c testserver.c mlookup.c clookup.c llookup.c dstm.c objstr.c trans.c 
+
+clean:
+       rm client server
diff --git a/Robust/src/Runtime/DSTM/interface/testserver.c b/Robust/src/Runtime/DSTM/interface/testserver.c
new file mode 100644 (file)
index 0000000..da4298e
--- /dev/null
@@ -0,0 +1,49 @@
+#include <pthread.h>
+#include "dstm.h"
+
+extern objstr_t *mainobjstore;
+int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *)};
+
+unsigned int createObjects(transrecord_t *record, unsigned short type) {
+       objheader_t *header, *tmp;
+       unsigned int size;
+       size = sizeof(objheader_t) + classsize[type] ;
+       header = transCreateObj(record, type);
+       tmp = (objheader_t *) objstrAlloc(mainobjstore, size);
+       memcpy(tmp, header, size);
+       mhashInsert(tmp->oid, tmp);
+       lhashInsert(tmp->oid, 1);
+       return 0;
+}
+
+int main()
+{
+       unsigned int val;
+       transrecord_t *myTrans;
+       pthread_t thread_Listen;
+
+       dstmInit();     
+       pthread_create(&thread_Listen, NULL, dstmListen, NULL);
+       // Start Transaction    
+       myTrans = transStart();
+
+       printf("Creating Transaction\n");
+       //Create Object1
+       if((val = createObjects(myTrans, 0)) != 0) {
+               printf("Error transCreateObj1");
+       }
+       //Create Object2
+       if((val = createObjects(myTrans, 1)) != 0) {
+               printf("Error transCreateObj2");
+       }
+       //Create Object3
+       if((val = createObjects(myTrans, 2)) != 0) {
+               printf("Error transCreateObj3");
+       }
+       //Create Object4
+       if((val = createObjects(myTrans, 3)) != 0) {
+               printf("Error transCreateObj4");
+       }
+       pthread_join(thread_Listen, NULL);
+       return 0;
+}