isc_mem_t *mctx;
size_t count;
hashmap_table_t tables[HASHMAP_NUM_TABLES];
+ uint_fast32_t iterators;
};
struct isc_hashmap_iter {
hashmap_node_t *oldtable = hashmap->tables[oldidx].table;
hashmap_node_t node;
+ /* Don't rehash when iterating */
+ INSIST(hashmap->iterators == 0);
+
/* Find first non-empty node */
while (hashmap->hiter < oldsize && oldtable[hashmap->hiter].key == NULL)
{
hashmap_node_t *current = NULL;
uint32_t pos;
+ INSIST(hashmap->iterators == 0);
+
hash = isc_hash_bits32(hashval, hashmap->tables[idx].hashbits);
/* Initialize the node to be store to 'node' */
.hindex = hashmap->hindex,
};
+ hashmap->iterators++;
+
*iterp = iter;
}
*iterp = NULL;
hashmap = iter->hashmap;
isc_mem_put(hashmap->mctx, iter, sizeof(*iter));
+
+ INSIST(hashmap->iterators > 0);
+ hashmap->iterators--;
}
static isc_result_t