Kaydet (Commit) 5255c791 authored tarafından Fred Drake's avatar Fred Drake

select.select(): Add note that though this function accepts empty lists,

                  using *only* empty lists may not be acceptable on all
                  platforms, with the specific caveat that it does not
                  work on Windows.  Also clarified list of acceptable
                  objects that may be in the lists, to let the user know
                  that file objects are not usable here on Windows.
üst f7d5aa61
...@@ -33,14 +33,16 @@ polling objects. ...@@ -33,14 +33,16 @@ polling objects.
\begin{funcdesc}{select}{iwtd, owtd, ewtd\optional{, timeout}} \begin{funcdesc}{select}{iwtd, owtd, ewtd\optional{, timeout}}
This is a straightforward interface to the \UNIX{} \cfunction{select()} This is a straightforward interface to the \UNIX{} \cfunction{select()}
system call. The first three arguments are lists of `waitable system call. The first three arguments are lists of `waitable
objects': either integers representing \UNIX{} file descriptors or objects': either integers representing file descriptors or
objects with a parameterless method named \method{fileno()} returning objects with a parameterless method named \method{fileno()} returning
such an integer. The three lists of waitable objects are for input, such an integer. The three lists of waitable objects are for input,
output and `exceptional conditions', respectively. Empty lists are output and `exceptional conditions', respectively. Empty lists are
allowed. The optional \var{timeout} argument specifies a time-out as a allowed, but acceptance of three empty lists is platform-dependent.
floating point number in seconds. When the \var{timeout} argument (It is known to work on \UNIX{} but not on Windows.) The optional
is omitted the function blocks until at least one file descriptor is \var{timeout} argument specifies a time-out as a floating point number
ready. A time-out value of zero specifies a poll and never blocks. in seconds. When the \var{timeout} argument is omitted the function
blocks until at least one file descriptor is ready. A time-out value
of zero specifies a poll and never blocks.
The return value is a triple of lists of objects that are ready: The return value is a triple of lists of objects that are ready:
subsets of the first three arguments. When the time-out is reached subsets of the first three arguments. When the time-out is reached
...@@ -52,14 +54,14 @@ objects (e.g. \code{sys.stdin}, or objects returned by ...@@ -52,14 +54,14 @@ objects (e.g. \code{sys.stdin}, or objects returned by
\function{open()} or \function{os.popen()}), socket objects \function{open()} or \function{os.popen()}), socket objects
returned by \function{socket.socket()},% returned by \function{socket.socket()},%
\withsubitem{(in module socket)}{\ttindex{socket()}} \withsubitem{(in module socket)}{\ttindex{socket()}}
\withsubitem{(in module os)}{\ttindex{popen()}} \withsubitem{(in module os)}{\ttindex{popen()}}.
and the module \module{stdwin}\refbimodindex{stdwin} which happens to You may also define a \dfn{wrapper} class yourself, as long as it has
define a function an appropriate \method{fileno()} method (that really returns a file
\function{fileno()}\withsubitem{(in module stdwin)}{\ttindex{fileno()}} descriptor, not just a random integer).
for just this purpose. You may \strong{Note:}\index{WinSock} File objects on Windows are not
also define a \dfn{wrapper} class yourself, as long as it has an acceptable, but sockets are. On Windows, the underlying
appropriate \method{fileno()} method (that really returns a \UNIX{} \cfunction{select()} function is provided by the WinSock library, and
file descriptor, not just a random integer). does not handle file desciptors that don't originate from WinSock.
\end{funcdesc} \end{funcdesc}
\subsection{Polling Objects \subsection{Polling Objects
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment