From c1488413e4a5f0fb4df102c036e7c3124def9816 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 24 Apr 2000 14:07:03 +0000 Subject: Added a provision to stop all threads before exiting from the test: the change to regrtest.py to unload all newly imported modules did something bad to the threads -- and I realized that they would never stop! --- Lib/test/test_fork1.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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() -- cgit v0.12