class SelectorList

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

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

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.

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  get_fd_set (SelectorMask selected_mask, fd_set& fds)

get_fd_set

[const]

Get a copy of the current list of monitored file descriptors in Unix fd_set format

Parameters:

theselected mask as SelectorMask (SEL_RD, SEL_WR, or SEL_EX)

Returns: the selected fd_set.

int  get_max_fd ()

get_max_fd

[const]

Get a the value of the largest monitored file descriptor

Returns: the maximum fd.

void  set_observer (SelectorListObserverBase& obs)

set_observer

Set the SelectorObserver object that will receive notifications

Returns: void

void  remove_observer ()

remove_observer

Remove the SelectorObserver object that receives notifications

Returns: void

void  callback_bad_descriptors ()

callback_bad_descriptors

[protected]


Generated by: pavlin on possum.icir.org on Thu Jul 8 23:48:10 2004, using kdoc $.