small edit
authorbdemsky <bdemsky>
Wed, 2 Dec 2009 19:21:38 +0000 (19:21 +0000)
committerbdemsky <bdemsky>
Wed, 2 Dec 2009 19:21:38 +0000 (19:21 +0000)
Robust/src/Runtime/DSTM/interface/altmlookup.c

index 88768dde0ed6fac8ce5ebd6a7509ffdef014d94c..498251870286e54f910604be8056c584fb255303 100644 (file)
@@ -42,7 +42,7 @@ void mhashInsert(unsigned int key, void *val) {
   }
 
   unsigned int keyindex=(key&mlookup.mask)>>1;
-  volatile unsigned int * lockptr=&mlookup.larray[keyindex&LOCKMASK].lock;
+  volatile unsigned int * lockptr=&mlookup.larray[keyindex&LOCKAMASK].lock;
   while(!write_trylock(lockptr)) {
     sched_yield();
   }
@@ -70,7 +70,7 @@ void *mhashSearch(unsigned int key) {
   unsigned int keyindex=(key&mlookup.mask)>>1;
   volatile unsigned int * lockptr=&mlookup.larray[keyindex&LOCKMASK].lock;
 
-  while(!write_trylock(lockptr)) {
+  while(!read_trylock(lockptr)) {
     sched_yield();
   }
 
@@ -84,7 +84,7 @@ void *mhashSearch(unsigned int key) {
     }
     node = node->next;
   } while (node!=NULL);
-  write_unlock(lockptr);
+  read_unlock(lockptr);
   return NULL;
 }