TICKIT_RUN(3)

πŸ“¦
version 0.4.6 Β· 2 versions
  • 0.4.6 Β· alpine 3.24, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.4.1 Β· ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– TICKIT_RUN πŸ’–

okay bestie, welcome to the tickit_run page from the Library Functions Manual, aka the one where we learn how to drive the event loop of the toplevel instance. yes, that one. the whole trio: tickit_run, tickit_stop, and tickit_tick. they run the show. literally. πŸŽ€


✨ NAME ✨

tickit_run, tickit_stop, tickit_tick β€” control the event loop of the toplevel instance πŸ¦‹


🌸 SYNOPSIS 🌸

#include <tickit.h>

void tickit_run(Tickit *t);
void tickit_stop(Tickit *t);

void tickit_tick(Tickit *t, TickitRunFlags flags);

and don't forget to Link with -ltickit, babe πŸ’…


πŸ’« DESCRIPTION πŸ’«

tickit_run() β€” the main character πŸ‘‘

so tickit_run() starts the IO event loop of the main toplevel instance, which is giving exactly what it sounds like: it lets the instance receive and react to terminal input, and send output content right back to the terminal. it's a whole conversation, fr fr. πŸ’¬

and here's the thing β€” once you invoke this function, it will block processing IO and not return until tickit_stop() gets called, or until a SIGINT shows up (which is usually you, the user, pressing Ctrl-C, iconic behaviour honestly 😌). so yeah, it commits. no half measures.

tickit_stop() β€” the exit strategy πŸšͺ

tickit_stop() causes a currently-running call to tickit_run() to return. that's it. that's the whole job. it's the "okay we're done here" text. slay.

tickit_tick() β€” one little sip of the loop πŸ“

tickit_tick() runs one iteration of the IO loop and returns. just one. a lil bite. its behaviour is controlled by the flags argument, which should be a bitmask of the following flags:

  • TICKIT_RUN_NOHANG β€” Perform only a single round of IO without blocking. tickit_tick() will check for IO, or timers that are ready, handle those, and return, but will not block further waiting if nothing is yet ready. no waiting around, no pining, it's giving unbothered ✨
  • TICKIT_RUN_NOSETUP β€” Do not perform any terminal setup before waiting on IO events. Usually this is only necessary early in startup, if the program is using the Tickit event loop for its own purposes before starting a terminal interface. 🧚
okay and here's the lore: without this flag, terminal setup will be run once the first time tickit_run or tickit_tick is called, and will remain valid until the toplevel instance is destroyed. so like, it happens once and then it stays. periodt. πŸ’…

🫢 RETURN VALUE 🫢

Neither tickit_run(), tickit_stop() nor tickit_tick() return a value. they're all void, they give you nothing back, and honestly? they're thriving. πŸ’€


🌈 SEE ALSO 🌈


and that's the page, bestie!! πŸŽ€ it's from the Library Functions Manual, it's the TICKIT_RUN(3) page, and yes it's still TICKIT_RUN(3) at the bottom too, no cap. go forth and loop responsibly βœ¨πŸ‘‘πŸ’–