diff options
author | Victor Stinner <vstinner@python.org> | 2022-06-15 09:42:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 09:42:10 (GMT) |
commit | 7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16 (patch) | |
tree | 7bc4498a4c5ad027208a714ff9281d2f4639e301 /Lib/test/fork_wait.py | |
parent | 4e9fa71d7e8e2f322f0b81b315ddc921f57384c0 (diff) | |
download | cpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.zip cpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.tar.gz cpython-7e9eaad864349d2cfd4c9ffc4453aba03b2cbc16.tar.bz2 |
Add test.support.busy_retry() (#93770)
Add busy_retry() and sleeping_retry() functions to test.support.
Diffstat (limited to 'Lib/test/fork_wait.py')
-rw-r--r-- | Lib/test/fork_wait.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py index 4d3dbd8..c565f59 100644 --- a/Lib/test/fork_wait.py +++ b/Lib/test/fork_wait.py @@ -54,10 +54,8 @@ class ForkWait(unittest.TestCase): self.threads.append(thread) # busy-loop to wait for threads - deadline = time.monotonic() + support.SHORT_TIMEOUT - while len(self.alive) < NUM_THREADS: - time.sleep(0.1) - if deadline < time.monotonic(): + for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False): + if len(self.alive) >= NUM_THREADS: break a = sorted(self.alive.keys()) |