Skip to content

Commit 8e4cd3c

Browse files
author
Vladimir Kotal
committed
how to deselect fd from poll
1 parent b3f349f commit 8e4cd3c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

network.tex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,9 +1379,11 @@
13791379
other one. On Solaris, for example, \texttt{poll} is a system call, and
13801380
\texttt{select} is then a library call implemented as a \texttt{poll} wrapper.
13811381
\item \texttt{poll} is necessary to use to test descriptor equal or higher than
1382-
\texttt{FD\_SETSIZE}.
1382+
\texttt{FD\_SETSIZE}.
13831383
\item Unlike \texttt{select} it is not necessary to refresh descriptor sets
1384-
after each call or nullify \texttt{revents}.
1384+
after each call or nullify \texttt{revents}. To deselect a file descriptor,
1385+
set the \item \texttt{fd} member of the \texttt{pollfd} structure to -1
1386+
(or reshuffle the array which is significantly more complex).
13851387
\item Time set to -1 has the same effect as \texttt{NULL} for \texttt{select}.
13861388
\item If the number of descriptors is set to 0 (\texttt{fds} should be then
13871389
\texttt{NULL}), \texttt{poll} can be simply used to sleep with less than one

0 commit comments

Comments
 (0)