wangzhengquan
2021-02-26 5f246a2c098b663fa44d87bc5c9ac5c8f74bbcc1
src/shm/hashtable.h
@@ -5,15 +5,22 @@
#include <functional>
#include <set>
#define MAPSIZE 100
#define MAPSIZE 1024
// 创建Queue数量的上限
#define QUEUE_COUNT_LIMIT 300
typedef struct hashtable_t
{
 struct tailq_header_t* array[MAPSIZE];
 int mutex;
 int queueCount;
 int currentKey; // 当前分配的key
 // int wlock;
 // int cond;
 // size_t readcnt;
} hashtable_t;
typedef void (*hashtable_foreach_cb)(int key, void *value);
@@ -29,10 +36,12 @@
int hashtable_lock(hashtable_t *hashtable);
int hashtable_unlock(hashtable_t *hashtable);
int hashtable_get_queue_count(hashtable_t *hashtable) ;
/** 
 * 遍历hash_table
 * @demo 
 * hashtable_foreach(&hashtable, [&](int key, void * value){
 * hashtable_foreach(hashtable, [&](int key, void * value){
 *   printf("%d, %p\n", key, value);
 * });
 *