start of new file
[IRC.git] / Robust / src / Runtime / DSTM / interface / mlookup.h
index b2f812192f7f1dfa0eb52ff9db95c7338dd1999f..aec887981fdc6b923c9aea8e8f336e37aafbbcf2 100644 (file)
@@ -3,21 +3,23 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <pthread.h>
 
-#define LOADFACTOR 0.75
+#define LOADFACTOR 0.5
 #define HASH_SIZE 100
 
-typedef struct hashlistnode {
+typedef struct mhashlistnode {
        unsigned int key;
        void *val; //this can be cast to another type or used to point to a larger structure
-       struct hashlistnode *next;
+       struct mhashlistnode *next;
 } mhashlistnode_t;
 
-typedef struct hashtable {
+typedef struct mhashtable {
        mhashlistnode_t *table; // points to beginning of hash table
        unsigned int size;
        unsigned int numelements;
        float loadfactor;
+       pthread_mutex_t locktable;
 } mhashtable_t;
 
 unsigned int mhashCreate(unsigned int size, float loadfactor);
@@ -26,6 +28,8 @@ unsigned mhashInsert(unsigned int key, void *val);
 void *mhashSearch(unsigned int key); //returns val, NULL if not found
 unsigned int mhashRemove(unsigned int key); //returns -1 if not found
 unsigned int mhashResize(unsigned int newsize);
+unsigned int *mhashGetKeys(unsigned int *numKeys);
+void mhashPrint();
 
 #endif