ck_ht: Add ck_ht_reset_size_spmc operation.

The ck_ht_reset_size_spmc operation takes an additional argument
that allows the user to specify the size of the new generation
of the hashtable.
ck_pring
Samy Al Bahra 12 years ago
parent 73531e9e48
commit 855a1472a8

@ -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 */

@ -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)
{

Loading…
Cancel
Save