From 5d4f9ae23d1c31bc7d515d2d66806f6342a8ab46 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Thu, 5 Dec 2013 15:46:06 -0500 Subject: [PATCH] ck_hs: Add ck_hs_rebuild operation. This operation is short-hand notation for rebuilding a hash table. This rebuild can occur in the presence of concurrent readers and will require twice the amount of memory of the existing hash table until completion. --- include/ck_hs.h | 1 + src/ck_hs.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/ck_hs.h b/include/ck_hs.h index 35cb023..098ae72 100644 --- a/include/ck_hs.h +++ b/include/ck_hs.h @@ -123,6 +123,7 @@ bool ck_hs_set(ck_hs_t *, unsigned long, const void *, void **); bool ck_hs_fas(ck_hs_t *, unsigned long, const void *, void **); void *ck_hs_remove(ck_hs_t *, unsigned long, const void *); bool ck_hs_grow(ck_hs_t *, unsigned long); +bool ck_hs_rebuild(ck_hs_t *); unsigned long ck_hs_count(ck_hs_t *); bool ck_hs_reset(ck_hs_t *); bool ck_hs_reset_size(ck_hs_t *, unsigned long); diff --git a/src/ck_hs.c b/src/ck_hs.c index 5b39061..6150bf7 100644 --- a/src/ck_hs.c +++ b/src/ck_hs.c @@ -366,6 +366,13 @@ restart: return true; } +bool +ck_hs_rebuild(struct ck_hs *hs) +{ + + return ck_hs_grow(hs, hs->map->capacity); +} + static void ** ck_hs_map_probe(struct ck_hs *hs, struct ck_hs_map *map,