CK_HT_GC(3)

πŸ’– CK_HT_GC β€” bestie edition πŸ’–

okay so you found the ck_ht_gc page, that's the Concurrency Kit manual (CK_HT_GC(3)) and honestly? it's giving "janitor of the hash table" and I'm obsessed. ✨


🌸 LIBRARY 🌸

Concurrency Kit β€” link it like libck, -lck πŸ’…


✨ SYNOPSIS ✨

#include <ck_ht.h>

bool
ck_ht_gc(ck_ht_t *ht, unsigned long cycles, unsigned long seed);

yes bestie, one function, three args, bool return. we love a clean signature. πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so ck_ht_gc() is the lil glow-up routine for your hash table β€” it runs a bunch of maintenance tasks on the table that ht points to. what kind of maintenance, you ask? πŸ‘€

  • defragmentation of probe sequences with respect to tombstones πŸ’€ (yes, tombstones, it's giving haunted house but make it data structures)
  • and recalculation of probe sequence bounds β€” but only in the case that the delete workload hint has been passed. no hint, no bounds recalc. periodt.

now let's talk args because the details matter:

  • cycles β€” tells the function how many hash table entries should be subject to attempted maintenance. and if cycles is 0, then maintenance is performed on the complete hash table. the whole thing. full send. πŸ”₯
  • seed β€” determines the start location of the maintenance process. and if cycles is non-zero, it is recommended that seed is some random value. yes, recommended. random seed, bestie, do it. 🎲
⚠️ heads up, this one's important: if the delete hint has been passed, the function will require an additional 12% of memory (with respect to existing memory usage of the set), until operation completion. twelve percent!! budget for it, queen. 😭

πŸ‘‘ RETURN VALUES πŸ‘‘

  • upon successful completion, ck_ht_gc(3) returns true 🫢
  • otherwise it returns false on failure due to memory allocation failure. sad girl hours. πŸ™ˆ

🌈 ERRORS 🌈

this function will only return false if there are internal memory allocation failures. that's it, that's the whole list. no other drama. πŸ’…


⭐ SEE ALSO ⭐

the whole friend group, go say hi:

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


and that's the tea, bestie β€” this page is from the Concurrency Kit (libck), dated December 18, 2013, filed under CK_HT_GC(3). go gc your hash table, you're doing amazing sweetie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from