annotate Doc/lib/libselect.tex @ 12357:5b59ea41db4e legacy-trunk

Install the docs (with fewer rules). Add descriptions for the system variables.
author Guido van Rossum <guido@python.org>
date Mon, 10 Apr 2000 19:36:27 +0000
parents e82e82b3b9ad
children acc72858eb72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
1 \section{\module{select} ---
10251
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 9150
diff changeset
2 Waiting for I/O completion}
d83935d14084 Shorten a few section titles.
Fred Drake <fdrake@acm.org>
parents: 9150
diff changeset
3
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
4 \declaremodule{builtin}{select}
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
5 \modulesynopsis{Wait for I/O completion on multiple streams.}
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 7877
diff changeset
6
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
7
7789
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
8 This module provides access to the function \cfunction{select()}
9150
4af87ced9f3a Add warning that on Windows it only works on sockets.
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
9 available in most operating systems. Note that on Windows, it only
4af87ced9f3a Add warning that on Windows it only works on sockets.
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
10 works for sockets; on other operating systems, it also works for other
4af87ced9f3a Add warning that on Windows it only works on sockets.
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
11 file types (in particular, on \UNIX{}, it works on pipes). It cannot
12223
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 10656
diff changeset
12 be used on regular files to determine whether a file has grown since
9150
4af87ced9f3a Add warning that on Windows it only works on sockets.
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
13 it was last read.
4af87ced9f3a Add warning that on Windows it only works on sockets.
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
14
4af87ced9f3a Add warning that on Windows it only works on sockets.
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
15 The module defines the following:
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
16
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 \begin{excdesc}{error}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 The exception raised when an error occurs. The accompanying value is
7789
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
19 a pair containing the numeric error code from \cdata{errno} and the
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
20 corresponding string, as would be printed by the \C{} function
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
21 \cfunction{perror()}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 \end{excdesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
23
7712
0cbc9df882b6 Change "\," to just "," in function signatures. This is easier to maintain,
Fred Drake <fdrake@acm.org>
parents: 7277
diff changeset
24 \begin{funcdesc}{select}{iwtd, owtd, ewtd\optional{, timeout}}
7789
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
25 This is a straightforward interface to the \UNIX{} \cfunction{select()}
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 system call. The first three arguments are lists of `waitable
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 objects': either integers representing \UNIX{} file descriptors or
7789
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
28 objects with a parameterless method named \method{fileno()} returning
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
29 such an integer. The three lists of waitable objects are for input,
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 output and `exceptional conditions', respectively. Empty lists are
2630
6c89df576d91 minor things
Guido van Rossum <guido@python.org>
parents: 2576
diff changeset
31 allowed. The optional \var{timeout} argument specifies a time-out as a
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
32 floating point number in seconds. When the \var{timeout} argument
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
33 is omitted the function blocks until at least one file descriptor is
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
34 ready. A time-out value of zero specifies a poll and never blocks.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
35
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
36 The return value is a triple of lists of objects that are ready:
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
37 subsets of the first three arguments. When the time-out is reached
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 without a file descriptor becoming ready, three empty lists are
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 returned.
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
40
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 Amongst the acceptable object types in the lists are Python file
7789
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
42 objects (e.g. \code{sys.stdin}, or objects returned by
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
43 \function{open()} or \function{os.popen()}), socket objects
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
44 returned by \function{socket.socket()},%
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
45 \withsubitem{(in module socket)}{\ttindex{socket()}}
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
46 \withsubitem{(in module os)}{\ttindex{popen()}}
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
47 and the module \module{stdwin}\refbimodindex{stdwin} which happens to
10656
8e72fc57f55f Work around LaTeX2HTML comment-handling bug.
Fred Drake <fdrake@acm.org>
parents: 10614
diff changeset
48 define a function
8e72fc57f55f Work around LaTeX2HTML comment-handling bug.
Fred Drake <fdrake@acm.org>
parents: 10614
diff changeset
49 \function{fileno()}\withsubitem{(in module stdwin)}{\ttindex{fileno()}}
7789
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
50 for just this purpose. You may
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 also define a \dfn{wrapper} class yourself, as long as it has an
7789
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
52 appropriate \method{fileno()} method (that really returns a \UNIX{}
88c53921bf88 Markup nits, index entries.
Fred Drake <fdrake@acm.org>
parents: 7712
diff changeset
53 file descriptor, not just a random integer).
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
54 \end{funcdesc}