---
name: "iom_wait"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/iom_wait"
---

# iom\_wait(3)

wait for event from I/O multiplexer

## NAME

iom\_wait - wait for event from I/O multiplexer

## SYNTAX

**#include \<libowfat/io.h\>**

int **iom\_wait**(iomux\_t\* c,\
                    int64\* fd, unsigned int\* events,\
 		   unsigned long timeout);

## DESCRIPTION

iom\_wait will wait for events registered to the I/O multiplexer with *iom\_add*. It will wait *timeout* milliseconds.

If during that time any of the registered events occur, *iom\_wait* will set *fd* to the file descriptor the event happened on, and *events* to the sum of IOM\_READ, IOM\_WRITE and IOM\_ERROR, depending on what event actually happened, and return 1.

If nothing happens during that time, it will return 0 and leave *fd* and *events* alone.

Note that the event registration is removed from the iomux\_t context if it occurs. You will have to call *iom\_wait* again after you handled the event, if you are still interested in it.

Closing a file descriptor with registered events will discard the event registration.

## LINKING

You may have to add *-lpthread* to the command line in the linking step.

## RETURN VALUE

iom\_wait returns 1 on success, 0 if there was a timeout, and -1 on error, setting errno. If *iom\_abort* was called on the I/O multiplexer context, it will return -2.

## SEE ALSO

iom\_init, iom\_add, iom\_abort
