File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Lib/test/test_free_threading Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 11import unittest
22
3+ from concurrent .futures import ThreadPoolExecutor
34from threading import Thread
45from unittest import TestCase
56
67from test .support import threading_helper , import_helper
78
89
9- multiprocessing_dummy = import_helper .import_module ('multiprocessing.dummy' )
10- Pool = multiprocessing_dummy .Pool
1110
1211NTHREADS = 6
1312BOTTOM = 0
@@ -36,11 +35,10 @@ def write(id0):
3635 A .attr = x
3736
3837
39- with Pool (NTHREADS ) as pool :
40- pool .apply_async (read , (1 ,))
41- pool .apply_async (write , (1 ,))
42- pool .close ()
43- pool .join ()
38+ with ThreadPoolExecutor (NTHREADS ) as pool :
39+ pool .submit (read , (1 ,))
40+ pool .submit (write , (1 ,))
41+ pool .shutdown (wait = True )
4442
4543 def test_attr_cache_consistency (self ):
4644 class C :
You can’t perform that action at this time.
0 commit comments