Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

iocallback(3i) [debian man page]

IOCallback(3I)						    InterViews Reference Manual 					    IOCallback(3I)

NAME
IOCallback - generic callback class for readers, writers, or I/O exception handlers SYNOPSIS
#include <Dispatch/iocallback.h> DESCRIPTION
For convenience, the macros defined in iocallback.h allow the user to define an iohandler which does nothing more than call an arbitrary object's member function. The actual code to read data from a file descriptor, write data to a file descriptor, handle an I/O exception on a file descriptor, or handle a timer's expiration can reside in any arbitrary class rather than in the iohandler. MACROS
declareIOCallback(T) Declare an iocallback type for the given class type T. implementIOCallback(T) Emit code at this point to implement the iocallback's member functions. IOCallback(T)* instance = new IOCallback(T)(...) Define an instance of the iocallback type for the given class type T. CONSTRUCTORS
typedef int T::IOReady(T)(int fd) typedef void T::IOTimer(T)(long sec, long usec) IOCallback(T)(T*, IOReady(T)* in, IOReady(T)* out = nil, IOReady(T)* ex = nil) IOCallback(T)(T*, IOTimer(T)*, IOReady(T)* in = nil, IOReady(T)* out = nil, IOReady(T)* ex = nil) Construct an instance of the iocallback type that will call the given member functions of the given class type T's instance. Note that you do not have to use the IOReady(T) or IOTimer(T) macros; rather, you only have to pass the address of a T member function, such as &T::inputReady. SEE ALSO
Dispatcher(3I), IOHandler(3I) InterViews 21 December 1990 IOCallback(3I)

Check Out this Related Man Page

Dispatcher(3I)						    InterViews Reference Manual 					    Dispatcher(3I)

NAME
Dispatcher - wait on multiple file descriptors until a condition occurs SYNOPSIS
#include <Dispatch/dispatcher.h> DESCRIPTION
Conceptually, the dispatcher plays the role of detecting new data on multiple input file descriptors and dispatching the data to the appro- priate iohandlers. 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(3I)). Since a program needs only one instance of Dispatcher, a static member function is provided to create that instance if necessary and return it. PUBLIC OPERATIONS
enum DispatcherMask { ReadMask, WriteMask, ExceptMask } virtual IOHandler* handler(int fd, DispatcherMask) virtual void link(int fd, DispatcherMask, IOHandler*) virtual void unlink(int fd) Return a file descriptor's iohandler, link a file descriptor to an iohandler, or unlink a file descriptor from its iohandlers. The DispatcherMask describes the I/O condition that the iohandler is interested in, such as whether 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. virtual void startTimer(long sec, long usec, IOHandler*) virtual void stopTimer(IOHandler*) Attach an iohandler to a timer or remove a timer before it expires. A timer expires after the given number of seconds and microsec- onds 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. virtual void dispatch() virtual boolean dispatch(long& sec, long& usec) With no arguments, block indefinitely until an I/O condition occurs or a timer expires and then notify the attached iohandler. With two arguments, block 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. static Dispatcher& instance() static void instance(Dispatcher*) With no arguments, create an instance of Dispatcher if it doesn't already exist and return it. With an argument, set the instance of Dispatcher that will be used throughout the program. SEE ALSO
select(2), IOHandler(3I) InterViews 21 December 1990 Dispatcher(3I)
Man Page