This module provides access to the select() and poll() functions available in most operating systems. Note that on Windows, it only works for sockets; on other operating systems, it also works for other file types (in particular, on Unix, it works on pipes). It cannot be used on regular files to determine whether a file has grown since it was last read.
The module defines the following:
) |
iwtd, owtd, ewtd[, timeout]) |
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 without a file descriptor becoming ready, three empty lists are returned.
Among the acceptable object types in the sequences are Python file
objects (e.g. sys.stdin
, or objects returned by
open() or os.popen()), socket objects
returned by socket.socket().You may also define a wrapper class yourself, as long as it has
an appropriate fileno() method (that really returns a file
descriptor, not just a random integer).
Note:
File objects on Windows are not acceptable, but sockets
are. On Windows, the underlying select()
function is provided by the WinSock library, and does not handle file
desciptors that don't originate from WinSock.
See About this document... for information on suggesting changes.