Commit 584623de authored by Shivaji's avatar Shivaji

removed print statements

parent f5f8b956
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
struct KV *array[MAX_SIZE]; struct KV *array[MAX_SIZE];
struct queue *qu=NULL; struct queue *qu=NULL;
struct queue *last; struct queue *last;
unsigned _Atomic lock; unsigned _Atomic lock=0;
void remove_element_from_deque(char *key) void remove_element_from_deque(char *key)
...@@ -76,6 +76,7 @@ void insert_into_queue(char *key) ...@@ -76,6 +76,7 @@ void insert_into_queue(char *key)
int remove_front_element() int remove_front_element()
{ {
while(ATOMIC_TEST_AND_SET(&(lock),1) == 1);
queue *temp = qu; queue *temp = qu;
qu = qu->next; qu = qu->next;
assert(temp != NULL); assert(temp != NULL);
...@@ -90,11 +91,11 @@ int remove_front_element() ...@@ -90,11 +91,11 @@ int remove_front_element()
return i; return i;
} }
} }
CLEAR(&(lock),0);
} }
int find_empty_location() int find_empty_location()
{ {
while(ATOMIC_TEST_AND_SET(&(lock),1) == 1);
for(int i=0;i<MAX_SIZE;i++) for(int i=0;i<MAX_SIZE;i++)
{ {
if(array[i]->valid == FALSE) if(array[i]->valid == FALSE)
...@@ -104,7 +105,6 @@ int find_empty_location() ...@@ -104,7 +105,6 @@ int find_empty_location()
} }
} }
int indx = remove_front_element(); int indx = remove_front_element();
CLEAR(&(lock),0);
return indx; return indx;
} }
...@@ -135,7 +135,6 @@ void cache_put(char *key, char *value) ...@@ -135,7 +135,6 @@ void cache_put(char *key, char *value)
if(array[i]->key!=NULL) { if(array[i]->key!=NULL) {
if(strcmp(array[i]->key , key) == 0) if(strcmp(array[i]->key , key) == 0)
{ {
printf("ENTERING INTO QUEUE\n");
indx = i; indx = i;
remove_element_from_deque(key); remove_element_from_deque(key);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment