Go to the previous, next section.
int select(int numfds, fd_set *readfds, fd_set
*writefds, fd_set *exceptfds, struct timeval *timeout);
Macro utilities:
FD_CLR(int fd, fd_set *set);
FD_ISSET(int fd, fd_set *set);
FD_SET(int fd, fd_set *set);
FD_ZERO(fd_set *set);
numfds: [in] the number of file descriptors to watch.
readfds: [in out] on entry, the file descriptor to watch for readability. On exit, the file descriptors that are readable.
writefds: [in out] on entry, the file descriptors to watch for writability. On exit, the file descriptors that are writable.
exceptfds: [in out] on entry, the file descriptor to watch exceptions. On exit, the file descriptors have exceptions raised.
timeout: [in out] on entry, the timeout value. On return, contains the remaining time.
Makes the calling task sleep until some conditions on the file descriptors become true or until a timeout value expires. There are three conditions for which files may be tested:
Whenever one of the conditions on one the specified files is true, the call returns.
There are four utilities provided for manipulation of the file descriptor sets:
FD_SET
FD_CLR
FD_ZERO
FD_ISSET
On success, returns zero. On error, returns -1 and sets errno
to
one of the following value:
EBADF
, EINTR
, EINVAL
or ENOMEM
Go to the previous, next section.