-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-29247: Document return value of epoll.poll() #4798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,48 +264,17 @@ object. | |
Edge and Level Trigger Polling (epoll) Objects | ||
---------------------------------------------- | ||
|
||
https://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:`EPOLLEXCLUSIVE` | Wake only one epoll object when the | | ||
| | associated fd has an event. The default (if | | ||
| | this flag is not set) is to wake all epoll | | ||
| | objects polling on a fd. | | ||
+-------------------------+-----------------------------------------------+ | ||
| :const:`EPOLLRDHUP` | Stream socket peer closed connection or shut | | ||
| | down writing half of connection. | | ||
+-------------------------+-----------------------------------------------+ | ||
| :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. | | ||
+-------------------------+-----------------------------------------------+ | ||
.. method:: epoll.poll(timeout=-1, maxevents=-1) | ||
|
||
Wait for events. *timeout* in seconds (float) Return a list of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can |
||
``(fd, eventmask)`` tuples if there's any event. Otherwise, an empty list | ||
is returned. | ||
|
||
.. versionchanged:: 3.5 | ||
The function is now retried with a recomputed timeout when interrupted by | ||
a signal, except if the signal handler raises an exception (see | ||
:pep:`475` for the rationale), instead of raising | ||
:exc:`InterruptedError`. | ||
|
||
.. method:: epoll.close() | ||
|
||
|
@@ -314,7 +283,7 @@ Edge and Level Trigger Polling (epoll) Objects | |
|
||
.. attribute:: epoll.closed | ||
|
||
``True`` if the epoll object is closed. | ||
Return ``True`` if the epoll object is closed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should |
||
|
||
|
||
.. method:: epoll.fileno() | ||
|
@@ -327,30 +296,65 @@ Edge and Level Trigger Polling (epoll) Objects | |
Create an epoll object from a given file descriptor. | ||
|
||
|
||
.. method:: epoll.register(fd[, eventmask]) | ||
|
||
Register a fd descriptor with the epoll object. | ||
.. method:: epoll.register(fd, eventmask=EPOLLIN | EPOLLOUT | EPOLLPRI) | ||
|
||
Register a *fd* descriptor with the epoll object. | ||
|
||
.. method:: epoll.modify(fd, eventmask) | ||
|
||
Modify a registered file descriptor. | ||
*eventmask* is an optional bitmask describing the type of events you want | ||
to check for. | ||
|
||
|
||
.. method:: epoll.unregister(fd) | ||
|
||
Remove a registered file descriptor from the epoll object. | ||
|
||
|
||
.. method:: epoll.poll(timeout=-1, maxevents=-1) | ||
.. method:: epoll.modify(fd, eventmask) | ||
|
||
Wait for events. timeout in seconds (float) | ||
Modify a registered file descriptor. | ||
|
||
.. versionchanged:: 3.5 | ||
The function is now retried with a recomputed timeout when interrupted by | ||
a signal, except if the signal handler raises an exception (see | ||
:pep:`475` for the rationale), instead of raising | ||
:exc:`InterruptedError`. | ||
|
||
The following constants can be used with | ||
:meth:`~epoll.register` and :meth:`~epoll.modify` methods. See | ||
:manpage:`epoll(4)` for more information. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this table should be under |
||
|
||
+-------------------------+-----------------------------------------------+ | ||
| 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:`EPOLLEXCLUSIVE` | Wake only one epoll object when the | | ||
| | associated fd has an event. The default (if | | ||
| | this flag is not set) is to wake all epoll | | ||
| | objects polling on a fd. | | ||
+-------------------------+-----------------------------------------------+ | ||
| :const:`EPOLLRDHUP` | Stream socket peer closed connection or shut | | ||
| | down writing half of connection. | | ||
+-------------------------+-----------------------------------------------+ | ||
| :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. | | ||
+-------------------------+-----------------------------------------------+ | ||
|
||
|
||
.. _poll-objects: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a reason for moving epoll.poll? The other sections (devpoll and poll) both have the
.poll
method defined last in the section. I don't know which is better, but moving this makes it inconsistent.