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
, POLLPRI
, and POLLOUT
, described in the table below. If not specified, the default value used will check for all 3 types of events.
Constant | Meaning |
---|---|
POLLIN | There is data to read |
POLLPRI | There is urgent data to read |
POLLOUT | Ready for output: writing will not block |
POLLERR | Error condition of some sort |
POLLHUP | Hung up |
POLLNVAL | Invalid request: descriptor not open |
Registering a file descriptor that’s already registered is not an error, and has the same effect as registering the descriptor exactly once.
Please login to continue.