From 554529bb69cd610e83db2c9a80b4f36f5225d80f Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期一, 27 七月 2020 17:56:34 +0800 Subject: [PATCH] restart bus --- src/queue/hashtable.c | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/queue/hashtable.c b/src/queue/hashtable.c index 21700ac..1fa6266 100755 --- a/src/queue/hashtable.c +++ b/src/queue/hashtable.c @@ -177,18 +177,7 @@ } -int hashtable_alloc_key(hashtable_t *hashtable) { - int key = START_KEY; - SemUtil::dec(hashtable->wlock); - while(_hashtable_get(hashtable, key) != NULL) { - key++; - } - - _hashtable_put(hashtable, key, (void *)1); - SemUtil::inc(hashtable->wlock); - return key; -} void *hashtable_get(hashtable_t *hashtable, int key) { SemUtil::dec(hashtable->mutex); @@ -251,6 +240,19 @@ } } +int hashtable_alloc_key(hashtable_t *hashtable) { + int key = START_KEY; + SemUtil::dec(hashtable->wlock); + + while(_hashtable_get(hashtable, key) != NULL) { + key++; + } + + _hashtable_put(hashtable, key, (void *)1); + SemUtil::inc(hashtable->wlock); + return key; +} + std::set<int> * hashtable_keyset(hashtable_t *hashtable) { std::set<int> *keyset = new std::set<int>; tailq_entry_t *item; @@ -267,3 +269,5 @@ } return keyset; } + + -- Gitblit v1.8.0