iom_wait(3)
π iom_wait β wait for event from I/O multiplexer π
okay bestie, welcome to iom_wait(3), straight out of the Library Functions Manual, section 3, and it's literally the moment your whole event loop has been waiting for (pun fully intended). sit down, grab a boba, let's get into it π§β¨
πΈ SYNTAX πΈ
#include <libowfat/io.h>
int iom_wait(iomux_t* c,
int64* fd, unsigned int* events,
unsigned long timeout);
look at her. so simple. so iconic. π
β¨ DESCRIPTION β¨
so iom_wait is the function that just... chills and waits for events that got registered to the I/O multiplexer with iom_add. she'll wait for timeout milliseconds. that's it, that's the vibe.
if during that time any of the registered events actually occur, iom_wait sets fd to the file descriptor the event happened on, and sets events to the sum of IOM_READ, IOM_WRITE and IOM_ERROR, depending on what event actually happened. then she returns 1. slay. π
if nothing happens during that time? she returns 0 and leaves fd and events completely alone. no touchy. π
β οΈ important note, bestie: the event registration is removed from theiomux_tcontext if it occurs. so you will have to calliom_waitagain after you handled the event, if you are still interested in it. she's not gonna keep reminding you. it's giving one-and-done. π
also, closing a file descriptor with registered events will discard the event registration. bye bye registration, you will not be missed π¦
π LINKING π
you may have to add -lpthread to the command line in the linking step. ngl, don't forget it, the linker will be so dramatic about it otherwise. π
π RETURN VALUE π
1β on success, queen behaviour π0β if there was a timeout, nothing happened, no biggie-1β on error, and she setserrnoso you know what went wrong π₯-2β ifiom_abortwas called on the I/O multiplexer context
periodt.
π SEE ALSO π
iom_initiom_addiom_abort
and that's the whole page, bestie π«Ά this was iom_wait(3) from the Library Functions Manual, third section energy, and she ate and left no crumbs. now go handle your events and remember to re-register them, i'm literally begging you ππΈβ¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms