(timeout=0.0, map=None)
| 168 | _exception(obj) |
| 169 | |
| 170 | def poll2(timeout=0.0, map=None): |
| 171 | # Use the poll() support added to the select module in Python 2.0 |
| 172 | if map is None: |
| 173 | map = socket_map |
| 174 | if timeout is not None: |
| 175 | # timeout is in milliseconds |
| 176 | timeout = int(timeout*1000) |
| 177 | pollster = select.poll() |
| 178 | if map: |
| 179 | for fd, obj in list(map.items()): |
| 180 | flags = 0 |
| 181 | if obj.readable(): |
| 182 | flags |= select.POLLIN | select.POLLPRI |
| 183 | # accepting sockets should not be writable |
| 184 | if obj.writable() and not obj.accepting: |
| 185 | flags |= select.POLLOUT |
| 186 | if flags: |
| 187 | pollster.register(fd, flags) |
| 188 | |
| 189 | r = pollster.poll(timeout) |
| 190 | for fd, flags in r: |
| 191 | obj = map.get(fd) |
| 192 | if obj is None: |
| 193 | continue |
| 194 | readwrite(obj, flags) |
| 195 | |
| 196 | poll3 = poll2 # Alias for backward compatibility |
| 197 |
nothing calls this directly
no test coverage detected
searching dependent graphs…