Go to the first, previous, next, last section, table of contents.


CNSelect -- Class Interface to Select(2) System Call

SYNOPSIS

#include <CNCL/Select.h>

TYPE

CN_SELECT

BASE CLASSES

CNObject

DERIVED CLASSES

None

RELATED CLASSES

None

DESCRIPTION

CNSelect is the interface to Unix's "select(2)" system call for synchronous I/O multiplexing. Select(2) (refer to Unix man pages, too) examines the descriptor sets and detects if they are ready for reading, writing, or having an exceptional status.

Constructors:

CNSelect();
CNSelect(CNParam *param);
CNSelect(int fd);
Initializes the three descriptor sets (one for the reading, writing and exceptional descriptor set) to null sets. Optionally the particular descriptor fd in the read set.


In addition to the member functions required by CNCL, CNSelect provides:

void add_read(int fd);
void del_read(int fd);
bool test_read(int fd);
Adds/deletes/tests file descriptor fd to the read set.
void add_write(int fd);
void del_write(int fd);
bool test_write(int fd);
Adds/deletes/tests file descriptor fd to the write set.
void add_except(int fd);
void del_except(int fd);
bool test_except(int fd);
Adds/deletes/tests file descriptor fd to the except set.
bool select();
bool select(long sec, long usec);
Returns true if there are any ready descriptors in the three descriptor sets. If the time values sec and usec for the timeout are set, false is returned if the timer expires.


Go to the first, previous, next, last section, table of contents.