Skip to content

Commit 140ff4a

Browse files
committed
Use ThreadPoolExecutor
1 parent ff5a757 commit 140ff4a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Lib/test/test_free_threading/test_type.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import unittest
22

3+
from concurrent.futures import ThreadPoolExecutor
34
from threading import Thread
45
from unittest import TestCase
56

67
from test.support import threading_helper, import_helper
78

89

9-
multiprocessing_dummy = import_helper.import_module('multiprocessing.dummy')
10-
Pool = multiprocessing_dummy.Pool
1110

1211
NTHREADS = 6
1312
BOTTOM = 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:

0 commit comments

Comments
 (0)