summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fork1.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-04-24 14:07:03 (GMT)
committerGuido van Rossum <guido@python.org>2000-04-24 14:07:03 (GMT)
commitc1488413e4a5f0fb4df102c036e7c3124def9816 (patch)
tree428751da0713c830eac8279d906f943e6ab0b0b1 /Lib/test/test_fork1.py
parent9d90a94fafa295851edd18843f6473c10131e555 (diff)
downloadcpython-c1488413e4a5f0fb4df102c036e7c3124def9816.zip
cpython-c1488413e4a5f0fb4df102c036e7c3124def9816.tar.gz
cpython-c1488413e4a5f0fb4df102c036e7c3124def9816.tar.bz2
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!
Diffstat (limited to 'Lib/test/test_fork1.py')
-rw-r--r--Lib/test/test_fork1.py8
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()