(timeout=0.0, map=None)
| 129 | obj.handle_error() |
| 130 | |
| 131 | def poll(timeout=0.0, map=None): |
| 132 | if map is None: |
| 133 | map = socket_map |
| 134 | if map: |
| 135 | r = []; w = []; e = [] |
| 136 | for fd, obj in list(map.items()): |
| 137 | is_r = obj.readable() |
| 138 | is_w = obj.writable() |
| 139 | if is_r: |
| 140 | r.append(fd) |
| 141 | # accepting sockets should not be writable |
| 142 | if is_w and not obj.accepting: |
| 143 | w.append(fd) |
| 144 | if is_r or is_w: |
| 145 | e.append(fd) |
| 146 | if [] == r == w == e: |
| 147 | time.sleep(timeout) |
| 148 | return |
| 149 | |
| 150 | r, w, e = select.select(r, w, e, timeout) |
| 151 | |
| 152 | for fd in r: |
| 153 | obj = map.get(fd) |
| 154 | if obj is None: |
| 155 | continue |
| 156 | read(obj) |
| 157 | |
| 158 | for fd in w: |
| 159 | obj = map.get(fd) |
| 160 | if obj is None: |
| 161 | continue |
| 162 | write(obj) |
| 163 | |
| 164 | for fd in e: |
| 165 | obj = map.get(fd) |
| 166 | if obj is None: |
| 167 | continue |
| 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 |
searching dependent graphs…