CK_HT_GROW_SPMC(3)
๐ ck_ht_grow_spmc(3) โ the manual page, but make it make sense ๐
okay bestie, so this is ck_ht_grow_spmc, and it lives in section 3 of the manual (the "library functions" section, iykyk). it's a Concurrency Kit thing, and no cap, it's genuinely useful. let's get into it ๐ซถ
๐ธ LIBRARY ๐ธ
Concurrency Kit โ that's libck, and you link it with -lck. periodt. ๐
โจ SYNOPSIS โจ
#include <ck_ht.h>
bool
ck_ht_grow_spmc(ck_ht_t *ht, uint64_t capacity);
likeโฆ that's the whole vibe. two arguments, one bool coming back at you. ๐
๐ฆ DESCRIPTION ๐ฆ
so here's the tea, bestie: ck_ht_grow_spmc() resizes the hash table so that it can hold at least the number of entries you passed in as capacity โ and it does that at a load factor of one. slay.
but wait, there's lore. the default load factor of a ck_ht hash table is 0.5. so if you're out here trying to minimize the likelihood of memory allocations for a hash table that's meant to store n entries, you should pass a capacity of 2n. do the math, trust. ๐งฎโจ
also, the default behavior of ck_ht is to round capacity to the next available power of two if it isn't already a power of two. so don't come for it when your numbers shift โ that's just how it do. ๐
and the moment you've all been waiting for: this function is safe to call in the presence of concurrent ck_ht_get_spmc(3) operations. concurrency? handled. main character energy only. ๐
๐ RETURN VALUES ๐
- on a successful completion,
ck_ht_grow_spmc()returnstrue๐ - otherwise it returns a
falsevalue ๐ญ
that's it. that's the return value situation. fr fr.
๐ ERRORS ๐
โ ๏ธ behavior is undefined if ht is uninitialized. like, don't do that. don't be that girl.
the function will only return false if there are internal memory allocation failures. that's the only reason. no other drama. ๐
๐ฅ SEE ALSO ๐ฅ
the whole friend group, in alphabetical-ish order, exactly as the original intended:
ck_ht_stat(3)ck_ht_init(3)ck_ht_destroy(3)ck_ht_hash(3)ck_ht_hash_direct(3)ck_ht_set_spmc(3)ck_ht_put_spmc(3)ck_ht_gc(3)ck_ht_get_spmc(3)ck_ht_remove_spmc(3)ck_ht_reset_spmc(3)ck_ht_reset_size_spmc(3)ck_ht_count(3)ck_ht_entry_empty(3)ck_ht_entry_key_set(3)ck_ht_entry_key_set_direct(3)ck_ht_entry_key(3)ck_ht_entry_key_length(3)ck_ht_entry_value(3)ck_ht_entry_set(3)ck_ht_entry_set_direct(3)ck_ht_entry_key_direct(3)ck_ht_entry_value_direct(3)ck_ht_iterator_init(3)ck_ht_next(3)
and if you want even more info, the original says it's available at http://concurrencykit.org/ ๐ โ go read up, bestie, knowledge is free and it's giving scholar.
and that's a wrap on the ck_ht_grow_spmc(3) manual page ๐โจ this version is from March 29, 2012, and it ships with Concurrency Kit โ so if you're repping that libck life, you're in the right place. stay growing, stay concurrent, stay iconic. mwah ๐
๐
๐ฆ where this page comes from
- alpine 3.24: ck-doc 0.7.2-r1 ยท BSD-2-Clause AND Apache-2.0
- debian bookworm: libck-dev 0.7.1-10 ยท BSD-2-Clause
- debian trixie: libck-dev 0.7.2-6 ยท BSD-2-Clause
- epel 10: ck-devel 0.7.2-1.el10_1 ยท BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- epel 9: ck-devel 0.7.0-10.el9 ยท BSD
- fedora 43: ck-devel 0.7.2-2.fc43 ยท BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 43: ck-devel 0.7.2-2.fc43 ยท BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 ยท BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 ยท BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- nixos 26.05: ck 0.7.2
- nixpkgs unstable: ck 0.7.2
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 ยท Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 ยท Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 ยท Apache-2.0 AND BSD-2-Clause
- ubuntu jammy: libck-dev 0.7.1-6ubuntu2 ยท BSD-2-Clause
- ubuntu noble: libck-dev 0.7.1-13build1 ยท BSD-2-Clause
- ubuntu questing: libck-dev 0.7.2-5ubuntu1
- ubuntu resolute: libck-dev 0.7.2-5ubuntu2 ยท BSD-2-Clause
- ubuntu stonking: libck-dev 0.7.2-11 ยท BSD-2-Clause
- Copyright 2012-2013 Samy Al Bahra
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms