File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -152,11 +152,8 @@ def run(self):
152152 """Overrides default threading.Thread run() method"""
153153 logging .debug ((self ._args , self ._kwargs ))
154154 try :
155- with self ._running_lock :
156- # Don't run if the thread was stopped before starting
157- if self .stopping .is_set ():
158- raise ActionKilledException
159- if self ._target :
155+ if self ._target :
156+ with self ._running_lock :
160157 self ._thread_proc (self ._target )(* self ._args , ** self ._kwargs )
161158 finally :
162159 # Avoid a refcycle if the thread is running a function with
@@ -279,15 +276,9 @@ def terminate(self, exception=ActionKilledException):
279276
280277 """
281278 _LOG .warning (f"Terminating thread { self } " )
282- if not self .is_alive ():
279+ if not ( self .is_alive () or self . _is_thread_proc_running () ):
283280 logging .debug ("Cannot kill thread that is no longer running." )
284- return
285- if not self ._is_thread_proc_running ():
286- logging .debug (
287- "Thread's _thread_proc function is no longer running, "
288- "will not kill; letting thread exit gracefully."
289- )
290- return
281+ return False
291282 self ._async_raise (exception )
292283
293284 # Wait (block) for the thread to finish closing. If the threaded function has cleanup code in a try-except,
You can’t perform that action at this time.
0 commit comments