File: iom_init.3

package info (click to toggle)
libowfat 0.34-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,288 kB
  • sloc: ansic: 20,181; makefile: 16
file content (30 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.TH iom_init 3
.SH NAME
iom_init \- create new I/O multiplexer
.SH SYNTAX
.B #include <libowfat/io.h>

int \fBiom_init\fP(iomux_t* c);
.SH DESCRIPTION
iom_init initializes an I/O multiplexer.

An I/O multiplexer is a context that can be used to do I/O multiplexing
with support for multiple threads. Add events to a multiplexer using
\fIiom_add\fR, and then get the next available event with
\fIiom_wait\fR. If you are done and want to signal all the threads
something, set a volatile global variable to tell the threads to stop
and then fall \fIiom_abort\fR to tell all pending iom_wait operations in
all threads to return immediately.

After \fIiom_init\fR is done, \fIiom_add\fR and \fIiom_wait\fR can be
called from different threads on the same context, and they will
synchronize internally.

.SH "LINKING"
You may have to add \fI-lpthread\fR to the command line in the linking
step.

.SH "RETURN VALUE"
iom_init returns 0 on success and -1 on error, setting errno.
.SH "SEE ALSO"
iom_add, iom_wait, iom_abort