class SelectorList

A class to provide an interface to I/O multiplexing. More...

Definition#include <selector.hh>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Protected Methods


Detailed Description

A SelectorList provides an entity where callbacks for pending I/O operations on file descriptors may be registered. The callbacks are invoked when one of the select methods is called and I/O is pending on the particular descriptors.

 SelectorList ()

SelectorList

Default constructor

bool  add_selector (int fd, SelectorMask mask, const SelectorCallback& scb)

add_selector

Add a hook for pending I/O operations on a callback.

Only one callback may be registered for each possible I/O event type (read, write, exception).

Multiple event types may share the same callback. If multiple event types share the same callback and multiple types of event are pending, the callback is invoked just once and the mask argument to the callback shows which events are pending.

Parameters:
filedescriptor.
maskmask of I/O event types that should invoke callback. An OR'ed combination of the available SelectorMask values.
scbcallback object that will be invoked when the descriptor.

Returns: true if function succeeds, false otherwise.

inline bool  add_selector (int fd, SelectorMask mask, SelectorHook h, void* cookie)

add_selector

[Deprecated] Historical add_selector method.

inline Selector  add_selector (int fd, SelectorMask mask)

add_selector

void  remove_selector (int fd, SelectorMask event_mask = SEL_ALL)

remove_selector

Remove hooks for pending I/O operations.

Parameters:
fdthe file descriptor.
maskof event types to be removed, e.g. an OR'ed combination of the available SelectorMask values.

int  select (timeval *timeout)

select

Wait for a pending I/O events and invoke callbacks when they become ready.

Parameters:
timeoutthe maximum period to wait for.

Returns: the number of callbacks that were made.

int  select (int millisecs)

select

Wait for a pending I/O events and invoke callbacks when they become ready.

Parameters:
millisecsthe maximum period in milliseconds to wait for.

Returns: the number of callbacks that were made.

inline size_t  descriptor_count ()

descriptor_count

[const]

Get the number of file descriptors with requested callbacks.

Returns: the number of file descriptors that currently have callbacks registered.

void  callback_bad_descriptors ()

callback_bad_descriptors

[protected]


Generated by: pavlin on possum.icir.org on Wed Dec 11 16:50:31 2002, using kdoc 2.0a54+XORP.