TICKIT_REF(3)

✨ TICKIT_REF πŸ’–

okay bestie, welcome to the TICKIT_REF(3) page, straight out of the Library Functions Manual β€” it's giving "how do I make my toplevel instance live forever / die on command" and honestly? iconic. sit down, hydrate, let's go 🫢

NAME ✨

tickit_ref, tickit_unref β€” the two little functions that adjust the refcount of the toplevel instance. that's it. that's the job. and they ate πŸ’…


SYNOPSIS 🌸

#include <tickit.h>

Tickit *tickit_ref(Tickit *t);
void tickit_unref(Tickit *t);

and like, don't forget to link with -ltickit, otherwise nothing works and you'll be sad 😭


DESCRIPTION πŸ¦‹

so, two functions, two vibes, one refcount. here's the tea β˜•

tickit_ref() bumps the stored refcount of the given toplevel instance up by one. and the cute part? it hands you back the pointer argument <em>itself</em>, which makes it perfect for chaining. chef's kiss 🀌

tickit_unref() is the other side of the coin β€” it drops the stored refcount of the given toplevel instance by one. and if that refcount hits zero? oh she's gone. the instance gets destroyed. periodt.

and when that destruction happens, a whole little chain reaction goes off:

  • it releases any resources controlled by it πŸ‘‘
  • it unbinds all pending timer and later callbacks, which causes them to be invoked with the TICKIT_EV_DESTROY flag if appropriate πŸ”₯
  • it also decrements the refcount on the terminal and root window instances β€” which will likely cause them to be destroyed too πŸ’€

so yeah. one unref can take the whole squad down with it. no cap.


RETURN VALUE ⭐

  • tickit_ref() returns a toplevel instance pointer. like, the pointer. the same one you passed in. she's loyal 🫢
  • tickit_unref() returns no value. nothing. void. she gives you nothing and that's valid πŸ™ˆ

SEE ALSO 🌈

tickit_new_stdio(3), tickit(7)

go read those next, bestie, they're part of the lore ✨


ok and one lil reminder before you go: tickit_unref() hitting zero is destruction β€” resources freed, callbacks unbound, terminal and root window probably joining the afterlife. not a drill. be mindful of your refcounts fr fr πŸ’–

that's the whole page! it lives in the <strong>Library Functions Manual</strong>, it's page <strong>TICKIT_REF(3)</strong>, and it's been serving cunt since forever. bye bestie, go write some slay code πŸŽ€πŸ’œπŸ§š