8 #define MLOADFACTOR 0.25
9 #define MHASH_SIZE 1024
11 typedef struct mhashlistnode {
13 void *val; //this can be cast to another type or used to point to a larger structure
14 struct mhashlistnode *next;
17 typedef struct mhashtable {
18 mhashlistnode_t *table; // points to beginning of hash table
21 unsigned int numelements;
22 unsigned int threshold;
24 pthread_mutex_t locktable;
27 unsigned int mhashCreate(unsigned int size, double loadfactor);
28 unsigned int mhashFunction(unsigned int key);
29 void mhashInsert(unsigned int key, void *val);
30 void *mhashSearch(unsigned int key); //returns val, NULL if not found
31 unsigned int mhashRemove(unsigned int key); //returns -1 if not found
32 unsigned int mhashResize(unsigned int newsize);
33 unsigned int *mhashGetKeys(unsigned int *numKeys);