selectors.BaseSelector.close()

close() Close the selector. This must be called to make sure that any underlying resource is freed. The selector shall not be used once it has been closed.

selectors.BaseSelector

class selectors.BaseSelector A BaseSelector is used to wait for I/O event readiness on multiple file objects. It supports file stream registration, unregistration, and a method to wait for I/O events on those streams, with an optional timeout. It’s an abstract base class, so cannot be instantiated. Use DefaultSelector instead, or one of SelectSelector, KqueueSelector etc. if you want to specifically use an implementation, and your platform supports it. BaseSelector and its concrete implement

select.select()

select.select(rlist, wlist, xlist[, timeout]) This is a straightforward interface to the Unix select() system call. The first three arguments are sequences of ‘waitable objects’: either integers representing file descriptors or objects with a parameterless method named fileno() returning such an integer: rlist: wait until ready for reading wlist: wait until ready for writing xlist: wait for an “exceptional condition” (see the manual page for what your system considers such a condition)

select.poll.unregister()

poll.unregister(fd) Remove a file descriptor being tracked by a polling object. Just like the register() method, fd can be an integer or an object with a fileno() method that returns an integer. Attempting to remove a file descriptor that was never registered causes a KeyError exception to be raised.

select.poll.register()

poll.register(fd[, eventmask]) Register a file descriptor 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 a fileno() method that returns an integer. File objects implement fileno(), so they can also be used as the argument. eventmask is an optional bitmask describing the type of events you want to check for, and can be a combination of the constants POLLIN, POLLPR

select.poll.poll()

poll.poll([timeout]) Polls the set of registered file descriptors, and returns a possibly-empty list containing (fd, event) 2-tuples for the descriptors that have events or errors to report. fd is the file descriptor, and event is a bitmask with bits set for the reported events for that descriptor — POLLIN for waiting input, POLLOUT to indicate that the descriptor can be written to, and so forth. An empty list indicates that the call timed out and no file descriptors had any events to report

select.poll.modify()

poll.modify(fd, eventmask) Modifies an already registered fd. This has the same effect as register(fd, eventmask). Attempting to modify a file descriptor that was never registered causes an OSError exception with errno ENOENT to be raised.

select.poll()

select.poll() (Not supported by all operating systems.) Returns a polling object, which supports registering and unregistering file descriptors, and then polling them for I/O events; see section Polling Objects below for the methods supported by polling objects.

select.PIPE_BUF

select.PIPE_BUF The minimum number of bytes which can be written without blocking to a pipe when the pipe has been reported as ready for writing by select(), poll() or another interface in this module. This doesn’t apply to other kind of file-like objects such as sockets. This value is guaranteed by POSIX to be at least 512. Availability: Unix. New in version 3.2.

select.kqueue.fromfd()

kqueue.fromfd(fd) Create a kqueue object from a given file descriptor.