MCPcopy Index your code
hub / github.com/RustPython/RustPython / poll2

Function poll2

Lib/test/support/asyncore.py:180–204  ·  view source on GitHub ↗
(timeout=0.0, map=None)

Source from the content-addressed store, hash-verified

178 _exception(obj)
179
180def poll2(timeout=0.0, map=None):
181 # Use the poll() support added to the select module in Python 2.0
182 if map is None:
183 map = socket_map
184 if timeout is not None:
185 # timeout is in milliseconds
186 timeout = int(timeout*1000)
187 pollster = select.poll()
188 if map:
189 for fd, obj in list(map.items()):
190 flags = 0
191 if obj.readable():
192 flags |= select.POLLIN | select.POLLPRI
193 # accepting sockets should not be writable
194 if obj.writable() and not obj.accepting:
195 flags |= select.POLLOUT
196 if flags:
197 pollster.register(fd, flags)
198
199 r = pollster.poll(timeout)
200 for fd, flags in r:
201 obj = map.get(fd)
202 if obj is None:
203 continue
204 readwrite(obj, flags)
205
206poll3 = poll2 # Alias for backward compatibility
207

Callers

nothing calls this directly

Calls 8

listClass · 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