bug fix: acquire lock before copying the object into cache
authoradash <adash>
Tue, 12 May 2009 00:41:54 +0000 (00:41 +0000)
committeradash <adash>
Tue, 12 May 2009 00:41:54 +0000 (00:41 +0000)
Robust/src/Runtime/STM/stm.c

index ddd4cfe631d1d67082b59dab7675905870f1023e..234f2391162aaff91afbcc1aca10a8dddc7b7c92 100644 (file)
@@ -247,7 +247,6 @@ __attribute__((pure)) void *transRead(void * oid, void *gl) {
   GETSIZE(size, header);
   size += sizeof(objheader_t);
   objcopy = (objheader_t *) objstrAlloc(size);
-  memcpy(objcopy, header, size);
 #ifdef STMSTATS
   header->accessCount++;
   //FIXME riskratio fix
@@ -259,6 +258,7 @@ __attribute__((pure)) void *transRead(void * oid, void *gl) {
     needLock(header,gl);
   }
 #endif
+  memcpy(objcopy, header, size);
   /* Insert into cache's lookup table */
   STATUS(objcopy)=0;
   t_chashInsert(oid, &objcopy[1]);