# :mod:select --- Waiting for I/O completion

This module provides access to the :c:func:select and :c:func:poll functions available in most operating systems, :c:func:epoll available on Linux 2.5+ and :c:func:kqueue available on most BSD. 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:

## Edge and Level Trigger Polling (epoll) Objects

http://linux.die.net/man/4/epoll

eventmask

Constant Meaning
:const:EPOLLIN Available for read
:const:EPOLLOUT Available for write
:const:EPOLLPRI Urgent data for read
:const:EPOLLERR Error condition happened on the assoc. fd
:const:EPOLLHUP Hang up happened on the assoc. fd
:const:EPOLLET Set Edge Trigger behavior, the default is Level Trigger behavior
:const:EPOLLONESHOT Set one-shot behavior. After one event is pulled out, the fd is internally disabled
:const:EPOLLRDNORM Equivalent to :const:EPOLLIN
:const:EPOLLRDBAND Priority data band can be read.
:const:EPOLLWRNORM Equivalent to :const:EPOLLOUT
:const:EPOLLWRBAND Priority data may be written.
:const:EPOLLMSG Ignored.

## Polling Objects

The :c:func:poll system call, supported on most Unix systems, provides better scalability for network servers that service many, many clients at the same time. :c:func:poll scales better because the system call only requires listing the file descriptors of interest, while :c:func:select builds a bitmap, turns on bits for the fds of interest, and then afterward the whole bitmap has to be linearly scanned again. :c:func:select is O(highest file descriptor), while :c:func:poll is O(number of file descriptors).

## Kevent Objects

http://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2