File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change
1
+ import _thread
1
2
import contextlib
2
3
import functools
3
- import _thread
4
+ import sys
4
5
import threading
5
6
import time
6
7
@@ -47,7 +48,7 @@ def threading_cleanup(*original_values):
47
48
values = None
48
49
49
50
time .sleep (0.01 )
50
- gc_collect ()
51
+ support . gc_collect ()
51
52
52
53
53
54
def reap_threads (func ):
@@ -98,7 +99,7 @@ def wait_threads_exit(timeout=None):
98
99
f"(count: { count } , old count: { old_count } )" )
99
100
raise AssertionError (msg )
100
101
time .sleep (0.010 )
101
- gc_collect ()
102
+ support . gc_collect ()
102
103
103
104
104
105
def join_thread (thread , timeout = None ):
@@ -124,7 +125,7 @@ def start_threads(threads, unlock=None):
124
125
t .start ()
125
126
started .append (t )
126
127
except :
127
- if verbose :
128
+ if support . verbose :
128
129
print ("Can't start %d threads, only %d threads started" %
129
130
(len (threads ), len (started )))
130
131
raise
@@ -133,15 +134,15 @@ def start_threads(threads, unlock=None):
133
134
try :
134
135
if unlock :
135
136
unlock ()
136
- endtime = starttime = time .monotonic ()
137
+ endtime = time .monotonic ()
137
138
for timeout in range (1 , 16 ):
138
139
endtime += 60
139
140
for t in started :
140
141
t .join (max (endtime - time .monotonic (), 0.01 ))
141
142
started = [t for t in started if t .is_alive ()]
142
143
if not started :
143
144
break
144
- if verbose :
145
+ if support . verbose :
145
146
print ('Unable to join %d threads during a period of '
146
147
'%d minutes' % (len (started ), timeout ))
147
148
finally :
You can’t perform that action at this time.
0 commit comments