1
- :mod: `select ` -- wait for events on a set of streams
1
+ :mod: `uselect ` -- wait for events on a set of streams
2
2
========================================================================
3
3
4
- .. module :: select
4
+ .. module :: uselect
5
5
:synopsis: wait for events on a set of streams
6
6
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).
16
9
17
10
Functions
18
11
---------
@@ -25,8 +18,8 @@ Functions
25
18
26
19
Wait for activity on a set of objects.
27
20
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.
30
23
31
24
.. _class : Poll
32
25
@@ -38,22 +31,22 @@ Methods
38
31
39
32
.. method :: poll.register(obj[, eventmask])
40
33
41
- Register `` obj `` for polling. `` eventmask `` is logical OR of:
34
+ Register * obj * for polling. * eventmask * is logical OR of:
42
35
43
36
* ``select.POLLIN `` - data available for reading
44
37
* ``select.POLLOUT `` - more data can be written
45
38
* ``select.POLLERR `` - error occurred
46
39
* ``select.POLLHUP `` - end of stream/connection termination detected
47
40
48
- `` eventmask `` defaults to ``select.POLLIN | select.POLLOUT ``.
41
+ * eventmask * defaults to ``select.POLLIN | select.POLLOUT ``.
49
42
50
43
.. method :: poll.unregister(obj)
51
44
52
- Unregister `` obj `` from polling.
45
+ Unregister * obj * from polling.
53
46
54
47
.. method :: poll.modify(obj, eventmask)
55
48
56
- Modify the `` eventmask `` for `` obj `` .
49
+ Modify the * eventmask * for * obj * .
57
50
58
51
.. method :: poll.poll([timeout])
59
52
@@ -65,3 +58,19 @@ Methods
65
58
timeout, an empty list is returned.
66
59
67
60
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