.TH iom_wait 3 .SH NAME iom_wait \- wait for event from I/O multiplexer .SH SYNTAX .B #include int \fBiom_wait\fP(iomux_t* c, int64* fd, unsigned int* events, unsigned long timeout); .SH DESCRIPTION iom_wait will wait for events registered to the I/O multiplexer with \fIiom_add\fR. It will wait \fItimeout\fR milliseconds. If during that time any of the registered events occur, \fIiom_wait\fR will set \fIfd\fR to the file descriptor the event happened on, and \fIevents\fR 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 \fIfd\fR and \fIevents\fR alone. Note that the event registration is removed from the iomux_t context if it occurs. You will have to call \fIiom_wait\fR 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. .SH "LINKING" You may have to add \fI-lpthread\fR to the command line in the linking step. .SH "RETURN VALUE" iom_wait returns 1 on success, 0 if there was a timeout, and -1 on error, setting errno. If \fIiom_abort\fR was called on the I/O multiplexer context, it will return -2. .SH "SEE ALSO" iom_init, iom_add, iom_abort