diff options
Diffstat (limited to 'Lib/test/fork_wait.py')
-rw-r--r-- | Lib/test/fork_wait.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/fork_wait.py b/Lib/test/fork_wait.py index 19b54ec..713039d 100644 --- a/Lib/test/fork_wait.py +++ b/Lib/test/fork_wait.py @@ -48,7 +48,12 @@ class ForkWait(unittest.TestCase): for i in range(NUM_THREADS): _thread.start_new(self.f, (i,)) - time.sleep(LONGSLEEP) + # busy-loop to wait for threads + deadline = time.monotonic() + 10.0 + while len(self.alive) < NUM_THREADS: + time.sleep(0.1) + if deadline < time.monotonic(): + break a = sorted(self.alive.keys()) self.assertEqual(a, list(range(NUM_THREADS))) |