()
| 144 | |
| 145 | # Helper to determine the remaining timeout. |
| 146 | def remaining(): |
| 147 | if timeout is None: |
| 148 | return None |
| 149 | end = start + timeout |
| 150 | remaining = end - time.time() |
| 151 | return remaining if remaining >= 0 else 0 |
| 152 | |
| 153 | # Now wait until all the futures have completed or we timeout. |
| 154 | finished = 0 |