diff --git a/include/ck_ht.h b/include/ck_ht.h index b218bfc..5900847 100644 --- a/include/ck_ht.h +++ b/include/ck_ht.h @@ -253,6 +253,7 @@ bool ck_ht_get_spmc(ck_ht_t *, ck_ht_hash_t, ck_ht_entry_t *); bool ck_ht_grow_spmc(ck_ht_t *, uint64_t); bool ck_ht_remove_spmc(ck_ht_t *, ck_ht_hash_t, ck_ht_entry_t *); bool ck_ht_reset_spmc(ck_ht_t *); +bool ck_ht_reset_size_spmc(ck_ht_t *, uint64_t); uint64_t ck_ht_count(ck_ht_t *); #endif /* CK_F_PR_LOAD_64 && CK_F_PR_STORE_64 */ diff --git a/src/ck_ht.c b/src/ck_ht.c index 3f5ea2f..069ce85 100644 --- a/src/ck_ht.c +++ b/src/ck_ht.c @@ -453,12 +453,12 @@ ck_ht_next(struct ck_ht *table, } bool -ck_ht_reset_spmc(struct ck_ht *table) +ck_ht_reset_size_spmc(struct ck_ht *table, uint64_t size) { struct ck_ht_map *map, *update; map = table->map; - update = ck_ht_map_create(table, map->capacity); + update = ck_ht_map_create(table, size); if (update == NULL) return false; @@ -467,6 +467,14 @@ ck_ht_reset_spmc(struct ck_ht *table) return true; } +bool +ck_ht_reset_spmc(struct ck_ht *table) +{ + struct ck_ht_map *map = table->map; + + return ck_ht_reset_size_spmc(table, map->capacity); +} + bool ck_ht_grow_spmc(ck_ht_t *table, uint64_t capacity) {