Dispatcher(3X) manual page
Table of Contents
Dispatcher - wait on multiple file descriptors until a condition
occurs
#include <ivplus/dispatcher.h>
Conceptually, Dispatcher
plays the role of detecting new data on multiple input file descriptors
and dispatching the data to the appropriate IOHandler. The Dispatcher
also notifies IOHandlers of expired timers. Notification of either an I/O
condition or an expired timer occurs by calling one of the IOHandler’s
virtual functions (see IOHandler(3X)
). Since a program needs only one instance
of Dispatcher, a static member function is provided to create that instance
if necessary, and return it.
Dispatcher
Creates
a new dispatcher.
The DispatcherMask is used to describe I/O conditions that
an IOHandler is interested in. A ReadMask indicates interest in reading
data from a file descriptor. A WriteMask indicates interest in writing data
to a file descriptor. An ExceptMask indicates interest in handling an exception
from the file descriptor.
Blocks
indefinitely until an I/O condition occurs or a timer expires. Then notifies
the attached IOHandler.
Blocks
no longer than the given number of seconds and microseconds. If both numbers
are zero, the function will return immediately after checking all file
descriptors and timers. The return value will be true if an I/O condition
caused the function to return and false if the function returned because
a timer expired or it exceeded the given poll time. The function will decrease
the given poll time by the amount of time it spent blocking.
Returns a file descriptor’s IOHandler.
The DispatcherMask describes the I/O condition that the IOHandler is
interested in, such as if the file descriptor has new data available for
reading. If the I/O condition occurs, the IOHandler will be expected to
read data from the file descriptor, write data to the file descriptor,
or handle the exception depending on the I/O condition.
Creates an instance of Dispatcher if it doesn’t already exist
and returns it.
Sets the instance of
Dispatcher that will be used throughout the program.
Links a file descriptor to an IOHandler.
The given DispatcherMask describes the I/O condition that the IOHandler
should handle.
Attaches
an IOHandler to a timer. A timer expires after sec seconds and usec microseconds
have elapsed. If a timer expires, the dispatcher will notify the attached
IOHandler. Timers will not expire until the program calls either variant
of Dispatcher::dispatch().
Removes a
timer before it expires. A timer expires after the given number of seconds
and microseconds have elapsed. If a timer expires, the dispatcher will notify
the attached IOHandler. Timers will not expire until the program calls
either variant of Dispatcher::dispatch().
Unlinks
a file descriptor from an IOHandler.
None.
No example
for this man page. See IOHandler(3X)
for examples.
dispatcher.h
select(2)
, IOHandler(3X)
.
Table of Contents