CK_HT_REMOVE_SPMC(3)

πŸ’– CK_HT_REMOVE_SPMC πŸ’–

okay bestie, gather round, because we're looking at ck_ht_remove_spmc(3) from the Concurrency Kit manual β€” that's manual section 3, the "library functions" girlies. and per the NAME line, this one is officially here to "resize a hash table if necessary" β€” that's literally what it says up top, so we're reporting it as found, no notes πŸ’…


✨ LIBRARY ✨

she lives in Concurrency Kit, aka libck, and you link her with -lck. that's the whole vibe.


πŸŽ€ SYNOPSIS πŸŽ€

#include <ck_ht.h>

bool
ck_ht_remove_spmc(ck_ht_t *ht, ck_ht_hash_t h, ck_ht_entry_t *entry);

look at her. three args, one bool return, zero drama.


πŸ¦‹ DESCRIPTION πŸ¦‹

so what does ck_ht_remove_spmc() actually do? she removes the key-value pair associated with the key that you specified with the entry argument. that's the whole assignment. bye bye entry πŸ‘‹

now here's the part where you have to know which mode your table is in, because the rules are different depending on how ht was born:

and same energy for the hash, bestie β€” it's an expectation, so don't be chaotic about it:

  • it is expected that h was initialized with ck_ht_hash(3) if ht was created with CK_HT_MODE_BYTESTRING.
  • if ht was initialized with CK_HT_MODE_DIRECT, then it is expected that h was initialized with the ck_ht_hash_direct(3) function.
ngl, matching the wrong hash function to the wrong mode is giving "main character makes a mistake" energy, and not in a cute way. read your mode first, then hash. periodt.

🌸 RETURN VALUES 🌸

  • if it worked? entry will contain the key-value pair that was found in the hash table, and ck_ht_remove_spmc() will return true. we ate. πŸ”₯
  • if the entry could not be found? ck_ht_remove_spmc() will return false. no pair, no vibes, just false. 😭

🌈 SEE ALSO 🌈

she does NOT work alone, she's part of a whole friend group:

additional information available at http://concurrencykit.org/ β€” go click, iykyk πŸ’œ


okay that's the page, bestie 🫢 this one was dated March 29, 2012, and the footer credits it as CK_HT_GROW_SPMC(3) β€” yes, the footer says grow while the top says remove, and we are simply not going to fight the manpage about it πŸ’€ anyway, mwah, go remove some entries responsibly βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from