CK_RHS_RESET(3)

πŸ’– CK_RHS_RESET πŸ’–

okay bestie, so this page lives in section 3 of the manual β€” CK_RHS_RESET(3) β€” and it's part of the Concurrency Kit situation. it's literally the "clear the whole thing" button for a hash set. no notes, just vibes. ✨


🌈 LIBRARY

Concurrency Kit β€” you link it as libck, like this: -lck. that's the whole library section, slay. πŸ’…


πŸŽ€ SYNOPSIS

#include <ck_rhs.h>

bool
ck_rhs_reset(ck_rhs_t *hs);

that's it. one include, one function, one pointer. clean. iconic. ✨


πŸ¦‹ DESCRIPTION

so ck_rhs_reset(3) removes every single key stored in the hash set that hs points to. like, all of them. every key. gone. the whole set gets a fresh start, main character energy. πŸ§ΉπŸ’–


⭐ RETURN VALUES

if everything goes fine, ck_rhs_reset(3) returns true. if it doesn't, it returns false. periodt. πŸ”₯

and the only way this function fails is if a replacement hash set couldn't be allocated internally. that's the one and only fail condition, no cap. 😭


πŸ’€ ERRORS

okay bestie, listen, this is the part where you pay attention, because it's giving undefined behavior and undefined behavior does NOT play nice:

  • behavior is undefined if hs is uninitialized. do not do that. πŸ™ˆ
  • behavior is undefined if this function is called by a non-writer thread. this is a writer-thread-only kind of function, iykyk. πŸ’…
fr fr, "undefined" is not a cute little oopsie. it's the technical way of saying "we make zero promises about what happens next." protect your peace and your threads. 🫢

🌸 SEE ALSO

the whole girl group, all linked up: ck_rhs_init(3), ck_rhs_move(3), ck_rhs_destroy(3), CK_RHS_HASH(3), ck_rhs_iterator_init(3), ck_rhs_next(3), ck_rhs_get(3), ck_rhs_put(3), ck_rhs_put_unique(3), ck_rhs_set(3), ck_rhs_fas(3), ck_rhs_remove(3), ck_rhs_reset_size(3), ck_rhs_grow(3), ck_rhs_gc(3), ck_rhs_rebuild(3), ck_rhs_count(3), ck_rhs_stat(3)

and if you want even more, there's always http://concurrencykit.org/ 🌈


k bye, that's the page!! this one's from the Concurrency Kit crew, dated September 17, 2012, and it's the CK_RHS_RESET(3) entry. go clear a hash set, bestie, you got this. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from