/* LOCK THE ENTIRE HASH TABLE */
#include "prelookup.h"
+extern objstr_t *prefetchcache;
prehashtable_t pflookup; //Global prefetch cache table
printf("Calloc error %s %d\n", __FILE__, __LINE__);
return 1;
}
-
+ pflookup.hack=NULL;
+ pflookup.hack2=NULL;
pflookup.table = nodes;
pflookup.size = size;
pflookup.numelements = 0; // Initial number of elements in the hash
int i, isFirstBin;
prehashlistnode_t *ptr, *prev, *curr;
+ objstr_t *oldcache=prefetchcache;
+ prefetchcache=objstrCreate(prefetchcache->size);
+
pthread_mutex_lock(&pflookup.lock);
ptr = pflookup.table;
for(i = 0; i < pflookup.size; i++) {
}
}
pthread_mutex_unlock(&pflookup.lock);
+
+ if (pflookup.hack2!=NULL) {
+ objstrDelete(pflookup.hack2);
+ }
+ pflookup.hack2=pflookup.hack;
+ pflookup.hack=oldcache;
}
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
+#include "dstm.h"
#define LOADFACTOR 0.5
#define HASH_SIZE 100
struct prehashlistnode *next;
} prehashlistnode_t;
+struct objstr;
+
typedef struct prehashtable {
- prehashlistnode_t *table; // points to beginning of hash table
- unsigned int size;
- unsigned int numelements;
- float loadfactor;
- pthread_mutex_t lock;
- pthread_mutexattr_t prefetchmutexattr;
- pthread_cond_t cond;
+ prehashlistnode_t *table; // points to beginning of hash table
+ unsigned int size;
+ unsigned int numelements;
+ float loadfactor;
+ pthread_mutex_t lock;
+ pthread_mutexattr_t prefetchmutexattr;
+ pthread_cond_t cond;
+ struct objstr *hack2;
+ struct objstr *hack;
} prehashtable_t;
/* Prototypes for hash*/
/* Read control message from Participant */
recv_data(sd, &control, sizeof(char));
recvcontrol = control;
-
/* Update common data structure and increment count */
tdata->recvmsg[tdata->thread_id].rcv_status = recvcontrol;