From: Guido van Rossum Date: Mon, 24 Apr 2000 14:07:03 +0000 (+0000) Subject: Added a provision to stop all threads before exiting from the test: X-Git-Tag: v2.0b1~1961 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1488413e4a5f0fb4df102c036e7c3124def9816;p=thirdparty%2FPython%2Fcpython.git 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! --- diff --git a/Lib/test/test_fork1.py b/Lib/test/test_fork1.py index c0e5b4496666..0d20fb3a6df8 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()