CK_HS_RESET(3)

πŸ’– CK_HS_RESET(3) β€” the ck_hs_reset glow-up πŸ’–

okay bestie, so this is a page from the Concurrency Kit manual β€” that's manual section 3, <pink>CK_HS_RESET</pink> β€” and it's literally all about yeeting every single key out of a hash set. no cap. let's get into it 🧚✨


🌸 LIBRARY 🌸

Concurrency Kit, aka libck. link it with -lck and you're good 🫢


✨ SYNOPSIS ✨

#include <ck_hs.h>

bool
ck_hs_reset(ck_hs_t *hs);

πŸ’… DESCRIPTION πŸ’…

ck_hs_reset(3) removes all the keys stored in the hash set that hs points at. like, all of them. every last one. it's giving spring cleaning, it's giving factory reset, it's giving "we're starting over and we're not talking about it" 😭

the hash set you're clearing out is the one pointed to by the hs argument. that's the whole vibe. πŸ’–


πŸ¦‹ RETURN VALUES πŸ¦‹

  • if it works out, ck_hs_reset(3) returns true βœ…
  • if it doesn't, it returns false πŸ’€

and here's the tea: the only way this thing fails is if a replacement hash set could not be allocated internally. so if it says false, it's not being dramatic β€” something genuinely couldn't get allocated. 😀


πŸ”₯ ERRORS πŸ”₯

⚠️ behavior is undefined if hs is uninitialized. do not pass her an uninitialized hash set, bestie, she will not survive it.
⚠️ behavior is undefined if this function is called by a non-writer thread. this is a writer-thread-only situation, periodt. if you're not the writer thread, stay in your lane πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

the whole friend group 🫢

additional information is available at http://concurrencykit.org/ ✨


and that's the whole page, no notes πŸ’… this one's from the Concurrency Kit source, dated September 17, 2012 β€” vintage but still slaying, fr fr. mwah, go clear that hash set πŸŽ€πŸ’–πŸŒˆ

πŸ“¦ where this page comes from