From f8ad4fef7c1e1faaf9ada59ab808827926a770ce Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Tue, 25 Jun 2024 12:23:38 -0700 Subject: [PATCH] deferred execution thread should be named and marked as daemon --- meshtastic/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/meshtastic/util.py b/meshtastic/util.py index 3193802..ef12344 100644 --- a/meshtastic/util.py +++ b/meshtastic/util.py @@ -266,9 +266,10 @@ class Acknowledgment: class DeferredExecution: """A thread that accepts closures to run, and runs them as they are received""" - def __init__(self, name=None): + def __init__(self, name): self.queue = Queue() - self.thread = threading.Thread(target=self._run, args=(), name=name) + # this thread must be marked as daemon, otherwise it will prevent clients from exiting + self.thread = threading.Thread(target=self._run, args=(), name=name, daemon=True) self.thread.daemon = True self.thread.start()