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
12import contextlib
23import functools
3- import _thread
4+ import sys
45import threading
56import time
67
@@ -47,7 +48,7 @@ def threading_cleanup(*original_values):
4748 values = None
4849
4950 time .sleep (0.01 )
50- gc_collect ()
51+ support . gc_collect ()
5152
5253
5354def reap_threads (func ):
@@ -98,7 +99,7 @@ def wait_threads_exit(timeout=None):
9899 f"(count: { count } , old count: { old_count } )" )
99100 raise AssertionError (msg )
100101 time .sleep (0.010 )
101- gc_collect ()
102+ support . gc_collect ()
102103
103104
104105def join_thread (thread , timeout = None ):
@@ -124,7 +125,7 @@ def start_threads(threads, unlock=None):
124125 t .start ()
125126 started .append (t )
126127 except :
127- if verbose :
128+ if support . verbose :
128129 print ("Can't start %d threads, only %d threads started" %
129130 (len (threads ), len (started )))
130131 raise
@@ -133,15 +134,15 @@ def start_threads(threads, unlock=None):
133134 try :
134135 if unlock :
135136 unlock ()
136- endtime = starttime = time .monotonic ()
137+ endtime = time .monotonic ()
137138 for timeout in range (1 , 16 ):
138139 endtime += 60
139140 for t in started :
140141 t .join (max (endtime - time .monotonic (), 0.01 ))
141142 started = [t for t in started if t .is_alive ()]
142143 if not started :
143144 break
144- if verbose :
145+ if support . verbose :
145146 print ('Unable to join %d threads during a period of '
146147 '%d minutes' % (len (started ), timeout ))
147148 finally :
You can’t perform that action at this time.
0 commit comments