Rudiments
Public Member Functions
listener Class Reference

List of all members.

Public Member Functions

 listener ()
virtual ~listener ()
void addFileDescriptor (filedescriptor *fd)
int32_t waitForNonBlockingRead (long sec, long usec)
int32_t waitForNonBlockingWrite (long sec, long usec)
listenerlistgetReadyList ()
void removeFileDescriptor (filedescriptor *fd)
void removeAllFileDescriptors ()
void retryInterruptedWaits ()
void dontRetryInterruptedWaits ()

Detailed Description

The listener class listens for activity on a pool of filedescriptors or children of the filedescriptor class.


Constructor & Destructor Documentation

listener::listener ( )

Creates an instance of the listener class.

virtual listener::~listener ( ) [virtual]

Deletes this instance of the listener class.


Member Function Documentation

void listener::addFileDescriptor ( filedescriptor fd)

Adds the specified file descriptor to the pool that the listener is listening on.

void listener::dontRetryInterruptedWaits ( )

Causes waits not to automatically retry if interrupted by a signal. The default is to retry automatically.

listenerlist* listener::getReadyList ( )

Returns the list of file descriptors that were ready for read after the last call to waitForNonBlockingRead() or ready for write after the last call to waitForNonBlockingWrite().

void listener::removeAllFileDescriptors ( )

Removes all file descriptors from the pool.

void listener::removeFileDescriptor ( filedescriptor fd)

Removes the specified file descriptor from the pool.

void listener::retryInterruptedWaits ( )

Causes waits to automatically retry if interrupted by a signal. This is the default.

int32_t listener::waitForNonBlockingRead ( long  sec,
long  usec 
)

Causes the application to wait until a read() will proceed without blocking or until "sec" seconds and "usec" microseconds have elapsed.

Entering -1 for either parameter causes the method to wait indefinitely.

Entering 0 for both parameters causes the method to fall through immediately, returning RESULT_TIMEOUT unless a read() will immediately proceed without blocking.

Returns RESULT_ERROR on error, RESULT_TIMEOUT on timeout and otherwise returns the number of file descriptors that are ready to be read from.

int32_t listener::waitForNonBlockingWrite ( long  sec,
long  usec 
)

Causes the application to wait until a write() will proceed without blocking or until "sec" seconds and "usec" microseconds have elapsed.

Entering -1 for either parameter causes the method to wait indefinitely.

Entering 0 for both parameters causes the method to fall through immediately, returning RESULT_TIMEOUT unless a write() will immediately proceed without blocking.

Returns RESULT_ERROR on error, RESULT_TIMEOUT on timeout and otherwise returns the number of file descriptors that are ready to be written to.