Issue #23799: Added test.support.start_threads() for running and cleaning up

multiple threads.
This commit is contained in:
Serhiy Storchaka 2015-04-01 13:06:18 +03:00
commit c05e260ecb
9 changed files with 75 additions and 78 deletions

View file

@ -284,15 +284,11 @@ class TestPendingCalls(unittest.TestCase):
context.lock = threading.Lock()
context.event = threading.Event()
for i in range(context.nThreads):
t = threading.Thread(target=self.pendingcalls_thread, args = (context,))
t.start()
threads.append(t)
self.pendingcalls_wait(context.l, n, context)
for t in threads:
t.join()
threads = [threading.Thread(target=self.pendingcalls_thread,
args=(context,))
for i in range(context.nThreads)]
with support.start_threads(threads):
self.pendingcalls_wait(context.l, n, context)
def pendingcalls_thread(self, context):
try: