TICKIT_WATCH_IO(3)
π TICKIT_WATCH_IO(3) π
okay bestie, gather round, because this is tickit_watch_io from the Library Functions Manual and she is so useful. buckle up π
β¨ NAME β¨
tickit_watch_io β invoke a callback when IO is possible
like literally, it's the "hey bestie, wake me up when there's something to read/write" function π
πΈ SYNOPSIS πΈ
#include <tickit.h>
typedef enum TickitIOCondition;
typedef struct {
int fd;
TickitIOCondition cond;
} TickitIOWatchInfo;
typedef int TickitCallbackFn(Tickit *t, TickitEventflags flags,
void *info, void *user);
void *tickit_watch_io(Tickit *t, int fd, TickitIOCondition cond,
TickitBindFlags flags, TickitCallbackFn *fn, void *user);
Link with -ltickit.
π¦ DESCRIPTION π¦
so tickit_watch_io() signs your callback function up to be invoked by the toplevel event loop whenever IO operations become possible on a given file descriptor. a registered callback gets invoked by a running call to tickit_run(3). it'll get called whenever the file descriptor is readable, writable, or in a hang-up condition β whichever condition types you asked for, no more no less. the info pointer points at a structure holding the file descriptor plus a bitmask of the IO operations that are currently possible. π
the cond argument you hand to tickit_watch_io() should be a bitmask of at least one of these values:
TICKIT_IO_INβ the file descriptor is ready to do an input operation, like reading bytes πTICKIT_IO_OUTβ the file descriptor is ready to do an output operation, like writing bytes βοΈTICKIT_IO_HUPβ the file descriptor is in a hang-up condition. typically this means a connection like a socket or a pipe has been closed by the peer. not me getting ghosted by a socket π
when the callback function is invoked, the info struct will contain the file descriptor in the fd field, and the current IO conditions in the cond field. that may be one of the values above, and in addition it may also be one of these:
TICKIT_IO_ERRβ the file descriptor is in an error condition πTICKIT_IO_INVALβ the file descriptor itself is invalid and does not represent an open file π
if you registered with the TICKIT_BIND_FIRST flag, the callback gets inserted at the start of the queue, coming before the others. if not, it's appended at the end. front of the line energy vs. joining the back of the queue, choose your vibe β¨
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. periodt.
π RETURN VALUE π
tickit_watch_io() returns an opaque identifier pointer. that's your little ticket, your receipt, your proof of registration π«Ά
π SEE ALSO π
tickit_new_stdio(3)tickit_watch_timer_after_msec(3)tickit_watch_timer_at_epoch(3)tickit_watch_later(3)tickit_watch_signal(3)tickit_watch_process(3)tickit_watch_cancel(3)tickit(7)
and that's the whole page, bestie β this one's from the TICKIT_WATCH_IO(3) era of the Library Functions Manual, and yeah, the footer is literally just the same TICKIT_WATCH_IO(3) all over again, iconic of her honestly. stay readable, stay writable, and never hang up unless the peer does it first πβ¨
π¦ where this page comes from
- debian bookworm: libtickit-dev 0.4.3-1 Β· MIT
- debian trixie: libtickit-dev 0.4.3-2 Β· MIT
- fedora 43: libtickit-devel 0.4.5-2.fc43 Β· MIT
- fedora 43: libtickit-devel 0.4.5-2.fc43 Β· MIT
- fedora 44: libtickit-devel 0.4.5-3.fc44 Β· MIT
- fedora 44: libtickit-devel 0.4.5-3.fc44 Β· MIT
- nixos 26.05: libtickit 0.4.5
- ubuntu noble: libtickit-dev 0.4.3-1.1build1 Β· MIT
- ubuntu questing: libtickit-dev 0.4.3-2
- ubuntu resolute: libtickit-dev 0.4.3-2build1 Β· MIT
- ubuntu stonking: libtickit-dev 0.4.3-2build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms