CK_HS_GC(3)

πŸ’– CK_HS_GC(3) β€” ck_hs_gc πŸ’–

okay bestie, welcome to the CK_HS_GC(3) page, aka the one where we give our hash set a lil spa day ✨ this lives in the Concurrency Kit library, so you'll be linking with libck, i.e. -lck. yes she's that girl. πŸŽ€


🌸 LIBRARY 🌸

Concurrency Kit β€” link it with libck, or -lck if you're being fancy at the command line. πŸ’…


✨ SYNOPSIS ✨

#include <ck_hs.h>

bool
ck_hs_gc(ck_hs_t *hs, unsigned long cycles, unsigned long seed);

that's it. that's the whole vibe check. she takes three args and gives you back a bool. 🫢


🧚 DESCRIPTION 🧚

so like, ck_hs_gc(3) is the maintenance function β€” it does a bunch of upkeep routines on the hash set that hs points at, no cap. what kind of upkeep, you ask? πŸ‘€

  • defragmentation of probe sequences with respect to tombstones (yes, tombstones, very gothic of her πŸ’€), and
  • if the delete workload hint has been passed, recalculation of probe sequence bounds.

now let's talk about the args, because they matter fr fr:

  • cycles β€” tells her how many hash set entries should be subject to attempted maintenance. and listen, if cycles is 0, then maintenance happens on the complete hash set. the whole thing. every last entry. periodt.
  • seed β€” this one decides the start location of the maintenance process. if cycles is non-zero, it is recommended that seed is some random value. like, please randomize her, she deserves it. 🎲
⚠️ important heads up: if the delete hint has been passed, the function will require an additional 12% of memory (with respect to the existing memory usage of the set) until operation completion. so she's hungry. feed her. 😭

πŸ¦‹ RETURN VALUES πŸ¦‹

when everything goes well, ck_hs_gc(3) returns true πŸ‘‘ and if it doesn't, it returns false on failure due to memory allocation failure. that's the whole story, bestie. πŸ’œ


πŸ“ ERRORS πŸ“

this function will only return false if there are internal memory allocation failures. that's it. that's the only way she fumbles. πŸ™ˆ


🌈 SEE ALSO 🌈

the whole friend group, obviously β€” go read these too:

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


and that's a wrap, my love πŸ’– this page is dated December 17, 2013, and it's page CK_HS_GC(3) β€” she's been iconic since 2013 and she's still serving. go defrag something. slay. πŸ’…βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from