@@ -57,11 +57,13 @@ def f(x):
|
57 | 57 | p = Pool(5) |
58 | 58 | results = [] |
59 | 59 | p.map_async(f, [1, 2, 3], callback=results.extend) |
60 | | - deadline = time.time() + 60 # up to 60 s to report the results |
| 60 | + start_time = time.monotonic() |
61 | 61 | while not results: |
62 | 62 | time.sleep(0.05) |
63 | | - if time.time() > deadline: |
64 | | - raise RuntimeError("Timed out waiting for results") |
| 63 | + # up to 1 min to report the results |
| 64 | + dt = time.monotonic() - start_time |
| 65 | + if dt > 60.0: |
| 66 | + raise RuntimeError("Timed out waiting for results (%.1f sec)" % dt) |
65 | 67 | results.sort() |
66 | 68 | print(start_method, "->", results) |
67 | 69 | """ |
@@ -85,11 +87,13 @@ def f(x):
|
85 | 87 | p = Pool(5) |
86 | 88 | results = [] |
87 | 89 | p.map_async(int, [1, 4, 9], callback=results.extend) |
88 | | -deadline = time.time() + 10 # up to 10 s to report the results |
| 90 | +start_time = time.monotonic() |
89 | 91 | while not results: |
90 | 92 | time.sleep(0.05) |
91 | | - if time.time() > deadline: |
92 | | - raise RuntimeError("Timed out waiting for results") |
| 93 | + # up to 1 min to report the results |
| 94 | + dt = time.monotonic() - start_time |
| 95 | + if dt > 60.0: |
| 96 | + raise RuntimeError("Timed out waiting for results (%.1f sec)" % dt) |
93 | 97 | results.sort() |
94 | 98 | print(start_method, "->", results) |
95 | 99 | """ |
|