#ifndef __HASHTABLE_H__ #define __HASHTABLE_H__ #include #include #define MAPSIZE 100 typedef struct hashtable_t { struct tailq_header_t* array[MAPSIZE]; int mutex; int wlock; int cond; size_t readcnt; } hashtable_t; typedef void (*hashtable_foreach_cb)(int key, void *value); void hashtable_init(hashtable_t *hashtable); void *hashtable_get(hashtable_t *hashtable, int key); void hashtable_put(hashtable_t *hashtable, int key, void *value); void *hashtable_remove(hashtable_t *hashtable, int key); void hashtable_removeall(hashtable_t *hashtable); void hashtable_foreach(hashtable_t *hashtable, hashtable_foreach_cb cb); void hashtable_printall(hashtable_t *hashtable); int hashtable_alloc_key(hashtable_t *hashtable); std::set * hashtable_keyset(hashtable_t *hashtable) ; #endif