CK_HS_RESET_SIZE(3)

✨ CK_HS_RESET_SIZE(3) ✨

ok so bestie, this is the manual page for ck_hs_reset_size β€” it lives in the Concurrency Kit man pages, section 3 (that's the library-functions girlies πŸ’…). pull up a chair, we're clearing out a whole hash set and giving it a whole new era.


πŸ’– NAME πŸ’–

ck_hs_reset_size β€” remove all keys from a hash set

no like literally all of them. every single key. gone. it's giving spring cleaning 🧹✨


πŸ“š LIBRARY πŸ“š

Concurrency Kit (libck, link it with -lck)


🌸 SYNOPSIS 🌸

#include <ck_hs.h>

bool
ck_hs_reset_size(ck_hs_t *hs, unsigned long size);

πŸ¦‹ DESCRIPTION πŸ¦‹

okok so the ck_hs_reset_size(3) function does two iconic things at once:

  • it removes all the keys stored in the hash set that hs points at πŸ—‘οΈ
  • and then it creates a brand new generation of that hash set, preallocated for size entries ✨

so it's not just a wipe, it's a glow-up. new generation, new capacity, same hash set, main character energy fr fr πŸ‘‘


πŸŽ€ RETURN VALUES πŸŽ€

if everything goes great, ck_hs_reset_size(3) returns true 🫢

otherwise it returns false on failure 😭

and lowkey the only way this function fails is if a replacement hash set couldn't be allocated internally. that's it. that's the whole failure mode. no cap.


πŸ’€ ERRORS πŸ’€

🚨 okay listen up because this part is serious:
  • behavior is undefined if hs is uninitialized πŸ™ˆ do not pass an uninitialized hash set, bestie, I am begging
  • behavior is undefined if this function is called by a non-writer thread πŸ’…βœ‹ writer threads only, no spectators

undefined behavior is not a vibe. it's the opposite of a vibe. it's a whole crime scene πŸ”₯


πŸ‘€ SEE ALSO πŸ‘€

the whole friend group, assembled:

Additional information available at http://concurrencykit.org/ 🌐


and that's the page!! this one shipped as part of Concurrency Kit, dated May 5, 2013 β€” an absolute vintage icon, we love a classic πŸŽ€πŸ’– slay, go clear out that hash set responsibly πŸ¦‹βœ¨

πŸ“¦ where this page comes from