From: adash Date: Tue, 12 May 2009 00:41:54 +0000 (+0000) Subject: bug fix: acquire lock before copying the object into cache X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=58053735a466f7ba0e967b4b141803184d82f519;p=IRC.git bug fix: acquire lock before copying the object into cache --- diff --git a/Robust/src/Runtime/STM/stm.c b/Robust/src/Runtime/STM/stm.c index ddd4cfe6..234f2391 100644 --- a/Robust/src/Runtime/STM/stm.c +++ b/Robust/src/Runtime/STM/stm.c @@ -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]);