.\" @sel_init
.\" @sel_initfile
.\" @sel_addfile
+.\" @sel_force
.\" @sel_rmfile
.\" @sel_addtimer
.\" @sel_rmtimer
.BI " void (*" func ")(int " fd ", unsigned " mode ", void *" p ),
.BI " void *" p );
.BI "void sel_addfile(sel_file *" f );
+.BI "void sel_force(sel_file *" f );
.BI "void sel_rmfile(sel_file *" f );
.BI "void sel_addtimer(sel_state *" s ", sel_timer *" t ,
and
.BR conn (3).
.SH "PROGRAMMING INTERFACE"
+.SS "Multiplexors"
A multiplexor is represented using the type
.B sel_state
defined in the
multiplexor. It's convenient to separate addition and removal from
initialization because file selectors often get added and removed many
times over during their lifetimes.
-.PP
+.SS "File selectors"
A file selector is initialized by the
.B sel_initfile
function. This requires a large number of arguments:
file's new condition, and the pointer argument set up at initialization
time.
.PP
+The function
+.B sel_force
+will sometimes be useful while a
+.B sel_select
+call (see below) is in progress. It marks a file selector as being
+ready even if it's not really. This is most useful when dynamically
+adding a write selector: it's likely that the write will succeed
+immediately, so it's worth trying. This will only work properly if
+the write is non-blocking.
+.PP
The member
.B fd
of the
structure is exported. It contains the file descriptor in which the
selector is interested. You may not modify this value, but it's useful
to be able to read it out \- it saves having to keep a copy.
-.PP
+.SS "Timer selectors"
Timer selectors are simpler. There are only two operations provided on
timer selectors: addition and removal. Initialization is performed as
part of the addition operation.
timer selector is removed and the event can't happen again. This is
normally what you want. Removing a timer is only useful (or safe!)
before the timer event has been sent.
-.PP
+.SS "Performing I/O"
Finally, the function
.B sel_select
is passed a multiplexor object. It waits for something interesting to
returns zero. Otherwise it returns -1, and the global variable
.B errno
is set appropriately.
-.SH "SELECT HOOK FUNCTIONS"
+.SS "Hook functions"
In order to interface other I/O multiplexing systems to this one, it's
possible to register
.I hook
.SH "SEE ALSO"
.BR select (2),
.BR poll (2),
+.BR conn (3),
+.BR selbuf (3),
.BR mLib (3).
.SH AUTHOR
Mark Wooding, <mdw@nsict.org>