CK_RHS_SET(3)
β¨ ck_rhs_set β bestie, we're putting a key INTO the hash set β¨
okay so real talk, this one lives in the Concurrency Kit (that's libck, and you link it with -lck) π she's a little function with big main character energy and she's about to file your key away in a hash set. let's get into it.
πΈ SYNOPSIS πΈ
#include <ck_rhs.h>
bool
ck_rhs_set(ck_rhs_t *hs, unsigned long hash, const void *key,
void **previous);
like. look at her. four args. no cap. π«Ά
π DESCRIPTION π
so ck_rhs_set(3) takes the key you point at with the key argument and stores it in the hash set that hs points to. the key in key is expected to already have the hash value you're passing in as the hash argument β and iykyk, that hash was generated earlier using the CK_RHS_HASH(3) macro. don't just make up a hash number, bestie, that's not the vibe. π
if the call to ck_rhs_set(3) goes through successfully, then the key in key is officially stored in the hash set pointed to by hs. iconic. β¨
but here's the tea β β if that key already exists in the hash set, then it gets replaced by key, and the previous value gets stored into the void pointer that previous points to. so you get your old thing back, cute.
and if previous is set to NULL? then key was not a replacement for an existing entry in the hash set. no prior entry, no drama. π
π RETURN VALUES π
on a successful completion, ck_rhs_set(3) returns true and honestly? slay. otherwise she returns false on failure. that's it, that's the whole vibe check. π
π¦ ERRORS π¦
β οΈ behavior is undefined ifkeyorhsare uninitialized. not "undefined" like quirky-undefined, undefined like we do not know what happens and it is not our problem. please initialize your stuff, bestie, i am begging π
the function will also return false if the hash set could not be enlarged to accomodate the key insertion. like, she tried to grow for you and she couldn't. it happens. π
π SEE ALSO π
the whole squad, fr fr:
ck_rhs_init(3)ck_rhs_move(3)ck_rhs_destroy(3)CK_RHS_HASH(3)ck_rhs_iterator_init(3)ck_rhs_next(3)ck_rhs_get(3)ck_rhs_put(3)ck_rhs_put_unique(3)ck_rhs_fas(3)ck_rhs_remove(3)ck_rhs_grow(3)ck_rhs_gc(3)ck_rhs_rebuild(3)ck_rhs_count(3)ck_rhs_reset(3)ck_rhs_reset_size(3)ck_rhs_stat(3)
and if you want even more lore, additional information is available at http://concurrencykit.org/ πβ¨
mwah π that's the page. this one's from September 17, 2012 and it's a CK_RHS_SET(3) situation through and through. go forth and set your keys, bestie, you've got this π«ΆπΈ
π¦ 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