Skip to content

Commit f8ad4fe

Browse files
committed
deferred execution thread should be named and marked as daemon
1 parent d1aadf0 commit f8ad4fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

meshtastic/util.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,10 @@ def reset(self):
266266
class DeferredExecution:
267267
"""A thread that accepts closures to run, and runs them as they are received"""
268268

269-
def __init__(self, name=None):
269+
def __init__(self, name):
270270
self.queue = Queue()
271-
self.thread = threading.Thread(target=self._run, args=(), name=name)
271+
# this thread must be marked as daemon, otherwise it will prevent clients from exiting
272+
self.thread = threading.Thread(target=self._run, args=(), name=name, daemon=True)
272273
self.thread.daemon = True
273274
self.thread.start()
274275

0 commit comments

Comments
 (0)