pthread_mutex_unlock(&llookup.locktable);
}
+ pthread_mutex_lock(&llookup.locktable);
ptr = llookup.table;
llookup.numelements++;
#ifdef DEBUG
printf("DEBUG(insert) oid = %d, mid =%d, index =%d\n",oid,mid, index);
#endif
- pthread_mutex_lock(&llookup.locktable);
if(ptr[index].next == NULL && ptr[index].oid == 0) { // Insert at the first position in the hashtable
ptr[index].oid = oid;
ptr[index].mid = mid;
int index;
lhashlistnode_t *ptr, *node;
+ pthread_mutex_lock(&llookup.locktable);
ptr = llookup.table; // Address of the beginning of hash table
index = lhashFunction(oid);
node = &ptr[index];
- pthread_mutex_lock(&llookup.locktable);
while(node != NULL) {
if(node->oid == oid) {
pthread_mutex_unlock(&llookup.locktable);
lhashlistnode_t *curr, *prev;
lhashlistnode_t *ptr, *node;
+ pthread_mutex_lock(&llookup.locktable);
ptr = llookup.table;
index = lhashFunction(oid);
curr = &ptr[index];
- pthread_mutex_lock(&llookup.locktable);
for (; curr != NULL; curr = curr->next) {
if (curr->oid == oid) { // Find a match in the hash table
llookup.numelements--; // Decrement the number of elements in the global hashtable
pthread_mutex_unlock(&tlookup.locktable);
}
+ index = thashFunction(transid);
ptr = tlookup.table;
tlookup.numelements++;
- index = thashFunction(transid);
#ifdef DEBUG
printf("DEBUG(insert) transid = %d, decision = %d, index = %d\n",transid, decision, index);
#endif
int index;
thashlistnode_t *ptr, *node;
+ pthread_mutex_lock(&tlookup.locktable);
ptr = tlookup.table; // Address of the beginning of hash table
index = thashFunction(transid);
node = &ptr[index];
- pthread_mutex_lock(&tlookup.locktable);
while(node != NULL) {
if(node->transid == transid) {
pthread_mutex_unlock(&tlookup.locktable);
thashlistnode_t *curr, *prev;
thashlistnode_t *ptr, *node;
+ pthread_mutex_lock(&tlookup.locktable);
ptr = tlookup.table;
index = thashFunction(transid);
curr = &ptr[index];
- pthread_mutex_lock(&tlookup.locktable);
for (; curr != NULL; curr = curr->next) {
if (curr->transid == transid) { // Find a match in the hash table
tlookup.numelements--; // Decrement the number of elements in the global hashtable
#ifdef RECOVERYSTATS
time(&fi);
- elapsedTime[numRecovery-1] = difftime(fi,st);
+ elapsedTime[numRecovery-1] = fi-st;
printRecoveryStat();
#endif