TICKIT_WATCH_LATER(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_WATCH_LATER πŸ’–

okay bestie, welcome to tickit_watch_later(3) β€” it's a Library Functions Manual page, it's giving "schedule a callback for the very next round of IO events", and honestly? it ate. let's get into it 🫢


✨ NAME ✨

tickit_watch_later β€” invoke a callback at the next round of IO events

like, the next one. not now. next. periodt. πŸ’…


🌸 SYNOPSIS 🌸

#include <tickit.h>

typedef int TickitCallbackFn(Tickit *t, TickitEventflags flags,
    void *info, void *user);

void *tickit_watch_later(Tickit *t, TickitBindFlags flags,
    TickitCallbackFn *fn, void *user);

and you gotta link it, no cap:

Link with -ltickit.

πŸ¦‹ DESCRIPTION πŸ¦‹

so tickit_watch_later() registers a callback function that the toplevel event loop is gonna invoke as it processes the next round of IO events. a registered callback gets invoked by a running call to tickit_run(3). and here's the iconic part: the callback function gets invoked once, and then it's destroyed afterwards. one and done, main character energy, no encore. πŸ’€

the info pointer will be NULL. just so you know. it's not ghosting you, it's literally NULL. πŸ™ˆ

when it does get invoked, the callback function is always passed both TICKIT_EV_FIRE and TICKIT_EV_UNBIND flags to its flags argument. both. always. that's the vibe check and it passed. βœ…

and if the callback had been registered with the TICKIT_BIND_DESTROY flag, then it will also be invoked with the TICKIT_EV_DESTROY flag if it has not yet been invoked by the time the toplevel instance is destroyed. so like, if the toplevel dips before your callback got its moment, it still shows up β€” just with TICKIT_EV_DESTROY instead. lowkey sweet of it fr fr πŸ₯Ή

now, queue placement, because order matters bestie:

  • if you registered with the TICKIT_BIND_FIRST flag, the callback will be inserted at the start of the queue, coming before others. cutting the line, but make it legal. πŸ‘‘
  • if not, it is appended at the end. respectfully waiting its turn. 🌈

and one more thing β€” if it gets cancelled by tickit_watch_cancel(3), the callback function is invoked with just the TICKIT_EV_UNBIND flag, but only if it had been registered with TICKIT_BIND_UNBIND. just the one flag. not both. read that twice, i know i did 😭


⭐ RETURN VALUE ⭐

tickit_watch_later() returns an opaque identifier pointer. that's it, that's the whole return value. hold onto it like it's a concert ticket bestie πŸŽ€


πŸ’œ SEE ALSO πŸ’œ

the whole friend group, obviously:


and that's the page!! this was TICKIT_WATCH_LATER(3), living in the Library Functions Manual, and yes the title really is just its own name again because manpages are extra like that πŸ’… go schedule something for the next round of IO events, you deserve it βœ¨πŸ’–