1- :mod: `select ` -- wait for events on a set of streams
1+ :mod: `uselect ` -- wait for events on a set of streams
22========================================================================
33
4- .. module :: select
4+ .. module :: uselect
55 :synopsis: wait for events on a set of streams
66
7- This module provides functions to wait for events on streams (select streams
8- which are ready for operations).
9-
10- Pyboard specifics
11- -----------------
12-
13- Polling is an efficient way of waiting for read/write activity on multiple
14- objects. Current objects that support polling are: :class: `pyb.UART `,
15- :class: `pyb.USB_VCP `.
7+ This module provides functions to efficiently wait for events on multiple
8+ streams (select streams which are ready for operations).
169
1710Functions
1811---------
@@ -25,8 +18,8 @@ Functions
2518
2619 Wait for activity on a set of objects.
2720
28- This function is provided for compatibility and is not efficient. Usage
29- of :class: `Poll ` is recommended instead.
21+ This function is provided by some MicroPython ports for compatibility
22+ and is not efficient. Usage of :class: `Poll ` is recommended instead.
3023
3124.. _class : Poll
3225
@@ -38,22 +31,22 @@ Methods
3831
3932.. method :: poll.register(obj[, eventmask])
4033
41- Register `` obj `` for polling. `` eventmask `` is logical OR of:
34+ Register * obj * for polling. * eventmask * is logical OR of:
4235
4336 * ``select.POLLIN `` - data available for reading
4437 * ``select.POLLOUT `` - more data can be written
4538 * ``select.POLLERR `` - error occurred
4639 * ``select.POLLHUP `` - end of stream/connection termination detected
4740
48- `` eventmask `` defaults to ``select.POLLIN | select.POLLOUT ``.
41+ * eventmask * defaults to ``select.POLLIN | select.POLLOUT ``.
4942
5043.. method :: poll.unregister(obj)
5144
52- Unregister `` obj `` from polling.
45+ Unregister * obj * from polling.
5346
5447.. method :: poll.modify(obj, eventmask)
5548
56- Modify the `` eventmask `` for `` obj `` .
49+ Modify the * eventmask * for * obj * .
5750
5851.. method :: poll.poll([timeout])
5952
@@ -65,3 +58,19 @@ Methods
6558 timeout, an empty list is returned.
6659
6760 Timeout is in milliseconds.
61+
62+ .. admonition :: Difference to CPython
63+ :class: attention
64+
65+ Tuples returned may contain more than 2 elements as described above.
66+
67+ .. method :: poll.ipoll([timeout])
68+
69+ Like :meth: `poll.poll `, but instead returns an iterator which yields
70+ callee-owned tuples. This function provides efficient, allocation-free
71+ way to poll on streams.
72+
73+ .. admonition :: Difference to CPython
74+ :class: attention
75+
76+ This function is a MicroPython extension.
0 commit comments