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 1
1
import unittest
2
2
3
+ from concurrent .futures import ThreadPoolExecutor
3
4
from threading import Thread
4
5
from unittest import TestCase
5
6
6
7
from test .support import threading_helper , import_helper
7
8
8
9
9
- multiprocessing_dummy = import_helper .import_module ('multiprocessing.dummy' )
10
- Pool = multiprocessing_dummy .Pool
11
10
12
11
NTHREADS = 6
13
12
BOTTOM = 0
@@ -36,11 +35,10 @@ def write(id0):
36
35
A .attr = x
37
36
38
37
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 )
44
42
45
43
def test_attr_cache_consistency (self ):
46
44
class C :
You can’t perform that action at this time.
0 commit comments