| | |
| | | } |
| | | |
| | | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | |
| | | } |
| | | return keyset; |
| | | } |
| | | |
| | | |