diff options
-rw-r--r-- | Lib/test/test_fork1.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py index c0e5b44..0d20fb3 100644 --- a/Lib/test/test_fork1.py +++ b/Lib/test/test_fork1.py @@ -18,8 +18,10 @@ NUM_THREADS = 4 alive = {} +stop = 0 + def f(id): - while 1: + while not stop: alive[id] = os.getpid() try: time.sleep(SHORTSLEEP) @@ -53,5 +55,9 @@ def main(): spid, status = os.waitpid(cpid, 0) assert spid == cpid assert status == 0, "cause = %d, exit = %d" % (status&0xff, status>>8) + global stop + # Tell threads to die + stop = 1 + time.sleep(2*SHORTSLEEP) # Wait for threads to die main() |