Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

17    select.h

Palm OS® Protein C/C++ Compiler Language & Library Reference

Palm OS® Developer Suite

     

The <select.h> header defines the select() macro, which is used for synchronous I/O multiplexing.

Functions and Macros ^TOP^

select Function ^TOP^

Purpose

Examines the I/O descriptor sets whose addresses are passed in to see if some of their descriptors are ready.

Declared In

posix/sys/select.h

Prototype

int select (
   int fd,
   fd_set *rfds,
   fd_set *wfds,
   fd_set *efds,
   struct timeval *timeout
)

Parameters

fd
The descriptors are checked in each set; that is, the descriptors from zero (0) through fd - 1 in the descriptor sets are examined.
rfds
The descriptors are checked to see if some of them are ready for reading.
wfds
The descriptors are checked to see if some of them are ready for writing.
efds
The descriptors are checked to see if some of them have an exceptional condition pending.
timeout
If timeout is a non-NULL pointer, it specifies a maximum interval to wait for the selection to complete. If timeout is a NULL pointer, then select() blocks indefinitely. To affect a poll, the timeout argument should be non-NULL, pointing to a zero-valued timeval structure.

Returns

Returns the number of ready descriptors that are contained in the descriptor sets. Otherwise, -1 is returned and the global variable errno is set to indicate the error. If the time limit expires, select() returns zero (0). If select() returns with an error, including one due to an interrupted call, the descriptor sets are unmodified.

Compatibility

This function is not in the C99 specification.

See Also

accept(), connect(), read(), recv(), send(), write()