summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_gc.py')
-rw-r--r--Lib/test/test_gc.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 5746c39..ed01c98 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -1,5 +1,5 @@
import unittest
-from test.test_support import verbose, run_unittest
+from test.test_support import verbose, run_unittest, start_threads
import sys
import time
import gc
@@ -352,19 +352,13 @@ class GCTests(unittest.TestCase):
old_checkinterval = sys.getcheckinterval()
sys.setcheckinterval(3)
try:
- exit = False
+ exit = []
threads = []
for i in range(N_THREADS):
t = threading.Thread(target=run_thread)
threads.append(t)
- try:
- for t in threads:
- t.start()
- finally:
+ with start_threads(threads, lambda: exit.append(1)):
time.sleep(1.0)
- exit = True
- for t in threads:
- t.join()
finally:
sys.setcheckinterval(old_checkinterval)
gc.collect()