gevent.select
– Waiting for I/O completion#
Waiting for I/O completion.
- class poll[source]#
Bases:
object
An implementation of
select.poll
that blocks only the current greenlet.With only one exception, the interface is the same as the standard library interface.
Caution
POLLPRI
data is not supported.New in version 1.1b1.
Changed in version 1.5: This is now always defined, regardless of whether the standard library defines
select.poll()
or not. Note that it may have different performance characteristics.- poll(timeout=None)[source]#
poll the registered fds.
Changed in version 1.2a1: File descriptors that are closed are reported with POLLNVAL.
Changed in version 1.3a2: Under libuv, interpret timeout values less than 0 the same as None, i.e., block. This was always the case with libev.
- register(fd, eventmask=<default value>)[source]#
Register a file descriptor fd with the polling object.
Future calls to the
poll`()
method will then check whether the file descriptor has any pending I/O events. fd can be either an integer, or an object with afileno()
method that returns an integer. File objects implementfileno()
, so they can also be used as the argument (but remember that regular files are usually always ready).eventmask is an optional bitmask describing the type of events you want to check for, and can be a combination of the constants
POLLIN
, andPOLLOUT
(POLLPRI
is not supported).
- select(rlist, wlist, xlist, timeout=None)[source]#
An implementation of
select.select
that blocks only the current greenlet.Caution
xlist is ignored.
Changed in version 1.2a1: Raise a
ValueError
if timeout is negative. This matches Python 3’s behaviour (Python 2 would raise aselect.error
). Previously gevent had undefined behaviour.Changed in version 1.2a1: Raise an exception if any of the file descriptors are invalid.