Fix tabbing.... Please fix your editors so they do tabbing correctly!!! (Spaces...
[IRC.git] / Robust / src / Runtime / DSTM / interface / abortreaders.c
index 860655b5e3f61a1b9b833b3979ef4ab3e8b82374..1db842096414cecbccd9d2672278b2fa5ca5d21c 100644 (file)
@@ -11,7 +11,7 @@ void initreaderlist() {
   freelist=NULL;
 }
 
-void addtransaction(unsigned int oid, struct transrecord * trans) {
+void addtransaction(unsigned int oid) {
   struct readerlist * rl;
   int i;
   if (pthread_mutex_trylock(&aborttablelock)!=0)
@@ -36,9 +36,9 @@ void addtransaction(unsigned int oid, struct transrecord * trans) {
     }
   }
   rl->numreaders++;
-  for(i=0;i<READERSIZE;i++) {
+  for(i=0; i<READERSIZE; i++) {
     if (rl->array[i]==NULL) {
-      rl->array[i]=trans;
+      rl->array[i]=&t_abort;
       pthread_mutex_unlock(&aborttablelock);
       return;
     }
@@ -50,7 +50,7 @@ void addtransaction(unsigned int oid, struct transrecord * trans) {
 void removetransaction(unsigned int oidarray[], unsigned int numoids) {
   int i,j;
   pthread_mutex_lock(&aborttablelock);
-  for(i=0;i<numoids;i++) {
+  for(i=0; i<numoids; i++) {
     unsigned int oid=oidarray[i];
     struct readerlist *rl=chashRemove2(aborttable, oid);
     struct readerlist *tmp;
@@ -59,11 +59,11 @@ void removetransaction(unsigned int oidarray[], unsigned int numoids) {
     do {
       int count=rl->numreaders;
       int j;
-      for(j=0;count;j++) {
-       struct transrecord *trans=rl->array[j];
-       if (trans!=NULL) {
-         trans->abort=1;//It's okay to set our own abort flag...it is
-                        //too late to abort us
+      for(j=0; count; j++) {
+       int *t_abort=rl->array[j];
+       if (t_abort!=NULL) {
+         *t_abort=1; //It's okay to set our own abort flag...it is
+         //too late to abort us
          count--;
        }
       }
@@ -76,22 +76,22 @@ void removetransaction(unsigned int oidarray[], unsigned int numoids) {
   pthread_mutex_unlock(&aborttablelock);
 }
 
-void removethisreadtransaction(unsigned char* oidverread, unsigned int numoids, struct transrecord * trans) {
+void removethisreadtransaction(unsigned char* oidverread, unsigned int numoids) {
   int i,j;
   pthread_mutex_lock(&aborttablelock);
-  for(i=0;i<numoids;i++) {
+  for(i=0; i<numoids; i++) {
     unsigned int oid=*((unsigned int *)oidverread);
     struct readerlist * rl=chashSearch(aborttable, oid);
     struct readerlist *first=rl;
     oidverread+=(sizeof(unsigned int)+sizeof(unsigned short));
     while(rl!=NULL) {
-      for(j=0;j<READERSIZE;j++) {
-       if (rl->array[j]==trans) {
+      for(j=0; j<READERSIZE; j++) {
+       if (rl->array[j]==&t_abort) {
          rl->array[j]=NULL;
          if ((--rl->numreaders)==0) {
            if (first==rl) {
              chashRemove2(aborttable, oid);
-             if (rl->next!=NULL) 
+             if (rl->next!=NULL)
                chashInsert(aborttable, oid, rl->next);
              rl->next=freelist;
              freelist=rl;
@@ -107,18 +107,17 @@ void removethisreadtransaction(unsigned char* oidverread, unsigned int numoids,
       first=rl;
       rl=rl->next;
     }
-  nextitem:
+nextitem:
     ;
   }
   pthread_mutex_unlock(&aborttablelock);
 }
 
-void removetransactionhash(chashtable_t *table, struct transrecord *trans) {
-  chashlistnode_t *ptr=table->table;
-  unsigned int size=table->size;
+void removetransactionhash() {
+  chashlistnode_t *ptr=c_table;
   int i,j;
   pthread_mutex_lock(&aborttablelock);
-  for(i=0;i<size;i++) {
+  for(i=0; i<c_size; i++) {
     chashlistnode_t *curr=&ptr[i];
     do {
       unsigned int oid=curr->key;
@@ -127,13 +126,13 @@ void removetransactionhash(chashtable_t *table, struct transrecord *trans) {
       struct readerlist * rl=chashSearch(aborttable, oid);
       struct readerlist *first=rl;
       while(rl!=NULL) {
-       for(j=0;j<READERSIZE;j++) {
-         if (rl->array[j]==trans) {
+       for(j=0; j<READERSIZE; j++) {
+         if (rl->array[j]==&t_abort) {
            rl->array[j]=NULL;
            if ((--rl->numreaders)==0) {
              if (first==rl) {
                chashRemove2(aborttable, oid);
-               if (rl->next!=NULL) 
+               if (rl->next!=NULL)
                  chashInsert(aborttable, oid, rl->next);
                rl->next=freelist;
                freelist=rl;
@@ -149,7 +148,7 @@ void removetransactionhash(chashtable_t *table, struct transrecord *trans) {
        first=rl;
        rl=rl->next;
       }
-    nextitem:
+nextitem:
       curr=curr->next;
     } while(curr!=NULL);
   }
@@ -157,22 +156,22 @@ void removetransactionhash(chashtable_t *table, struct transrecord *trans) {
 }
 
 
-void removethistransaction(unsigned int oidarray[], unsigned int numoids, struct transrecord * trans) {
+void removethistransaction(unsigned int oidarray[], unsigned int numoids) {
   int i,j;
   pthread_mutex_lock(&aborttablelock);
-  for(i=0;i<numoids;i++) {
+  for(i=0; i<numoids; i++) {
     unsigned int oid=oidarray[i];
     struct readerlist * rl=chashSearch(aborttable, oid);
-    
+
     struct readerlist *first=rl;
     while(rl!=NULL) {
-      for(j=0;j<READERSIZE;j++) {
-       if (rl->array[j]==trans) {
+      for(j=0; j<READERSIZE; j++) {
+       if (rl->array[j]==&t_abort) {
          rl->array[j]=NULL;
          if ((--rl->numreaders)==0) {
            if (first==rl) {
              chashRemove2(aborttable, oid);
-             if (rl->next!=NULL) 
+             if (rl->next!=NULL)
                chashInsert(aborttable, oid, rl->next);
              rl->next=freelist;
              freelist=rl;
@@ -188,7 +187,7 @@ void removethistransaction(unsigned int oidarray[], unsigned int numoids, struct
       first=rl;
       rl=rl->next;
     }
-  nextitem:
+nextitem:
     ;
   }
   pthread_mutex_unlock(&aborttablelock);