MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / poll

Function poll

tools/python-3.11.9-amd64/Lib/asyncore.py:130–167  ·  view source on GitHub ↗
(timeout=0.0, map=None)

Source from the content-addressed store, hash-verified

128 obj.handle_error()
129
130def poll(timeout=0.0, map=None):
131 if map is None:
132 map = socket_map
133 if map:
134 r = []; w = []; e = []
135 for fd, obj in list(map.items()):
136 is_r = obj.readable()
137 is_w = obj.writable()
138 if is_r:
139 r.append(fd)
140 # accepting sockets should not be writable
141 if is_w and not obj.accepting:
142 w.append(fd)
143 if is_r or is_w:
144 e.append(fd)
145 if [] == r == w == e:
146 time.sleep(timeout)
147 return
148
149 r, w, e = select.select(r, w, e, timeout)
150
151 for fd in r:
152 obj = map.get(fd)
153 if obj is None:
154 continue
155 read(obj)
156
157 for fd in w:
158 obj = map.get(fd)
159 if obj is None:
160 continue
161 write(obj)
162
163 for fd in e:
164 obj = map.get(fd)
165 if obj is None:
166 continue
167 _exception(obj)
168
169def poll2(timeout=0.0, map=None):
170 # Use the poll() support added to the select module in Python 2.0

Callers

nothing calls this directly

Calls 11

listFunction · 0.85
_exceptionFunction · 0.85
sleepMethod · 0.80
readFunction · 0.70
writeFunction · 0.70
itemsMethod · 0.45
readableMethod · 0.45
writableMethod · 0.45
appendMethod · 0.45
selectMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected