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

Function poll2

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

Source from the content-addressed store, hash-verified

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
171 if map is None:
172 map = socket_map
173 if timeout is not None:
174 # timeout is in milliseconds
175 timeout = int(timeout*1000)
176 pollster = select.poll()
177 if map:
178 for fd, obj in list(map.items()):
179 flags = 0
180 if obj.readable():
181 flags |= select.POLLIN | select.POLLPRI
182 # accepting sockets should not be writable
183 if obj.writable() and not obj.accepting:
184 flags |= select.POLLOUT
185 if flags:
186 pollster.register(fd, flags)
187
188 r = pollster.poll(timeout)
189 for fd, flags in r:
190 obj = map.get(fd)
191 if obj is None:
192 continue
193 readwrite(obj, flags)
194
195poll3 = poll2 # Alias for backward compatibility
196

Callers

nothing calls this directly

Calls 8

listFunction · 0.85
readwriteFunction · 0.85
pollMethod · 0.45
itemsMethod · 0.45
readableMethod · 0.45
writableMethod · 0.45
registerMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected