Update use of Thread.isAlive() to Thread.is_alive().

This commit is contained in:
Tom Keffer
2020-10-23 10:28:29 -07:00
parent dea4459a07
commit a45476c675
3 changed files with 5 additions and 5 deletions

View File

@@ -4081,7 +4081,7 @@ class CCommunicationService(object):
self.running = False
log.debug('stopRFThread: waiting for RF thread to terminate')
self.child.join(self.thread_wait)
if self.child.isAlive():
if self.child.is_alive():
log.error('unable to terminate RF thread after %d seconds'
% self.thread_wait)
else:

View File

@@ -792,7 +792,7 @@ class StdReport(StdService):
# Do not launch the reporting thread if an old one is still alive.
# To guard against a zombie thread (alive, but doing nothing) launch
# anyway if enough time has passed.
if self.thread and self.thread.isAlive():
if self.thread and self.thread.is_alive():
thread_age = time.time() - self.launch_time
if thread_age < self.max_wait:
log.info("Launch of report thread aborted: existing report thread still running")
@@ -816,7 +816,7 @@ class StdReport(StdService):
if self.thread:
log.info("Shutting down StdReport thread")
self.thread.join(20.0)
if self.thread.isAlive():
if self.thread.is_alive():
log.error("Unable to shut down StdReport thread")
else:
log.debug("StdReport thread has been terminated")

View File

@@ -148,12 +148,12 @@ class StdRESTful(weewx.engine.StdService):
@staticmethod
def shutDown_thread(q, t):
"""Function to shut down a thread."""
if q and t.isAlive():
if q and t.is_alive():
# Put a None in the queue to signal the thread to shutdown
q.put(None)
# Wait up to 20 seconds for the thread to exit:
t.join(20.0)
if t.isAlive():
if t.is_alive():
log.error("Unable to shut down %s thread", t.name)
else:
log.debug("Shut down %s thread.", t.name)